Skip to content

Search (CTRL+F) Doesn't Auto-Update After Content Changes #3405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jatin24062005 opened this issue Mar 18, 2025 · 1 comment
Closed

Search (CTRL+F) Doesn't Auto-Update After Content Changes #3405

Jatin24062005 opened this issue Mar 18, 2025 · 1 comment
Labels

Comments

@Jatin24062005
Copy link
Contributor

p5.js version

No response

What is your operating system?

None

Web browser and version

No response

Actual Behavior

The search results do not update when new text is added.
The search overlay remains stuck on the initial results, even if content changes.

p5.js.Web.Editor.-.Google.Chrome.2025-03-06.17-17-09.mp4

Expected Behavior

When text matching the search query is added or removed, the search results should automatically update.
The search overlay should refresh dynamically, without requiring the user to manually restart the search.

Steps to reproduce

  1. Open https://editor.p5js.org/ and Add hello (any text ) 4 times
  2. Observe the search results count (0/4 if "hello" appears 4 times).
  3. Add more instances of the searched word (hello) in the editor.
  4. Notice that the search result count and highlighting remain the same, not updating dynamically.
@raclim
Copy link
Collaborator

raclim commented Mar 28, 2025

This issue has been resolved by an earlier PR (#3362), which has been merged into the develop branch. It's currently not on https://editor.p5js.org because I haven't pushed the develop to be deployed on production yet. I'm planning to push a release next week, which should reflect these changes. The new releases can be found on the Releases page.

I looked into your attached PR, which specifically reapplies the search on every document change. Although it could help keep results consistently up to date, I don't think we would implement this since re-running the search logic on every keystroke—especially in larger files—can introduce unnecessary performance overhead. Additionally, it may result in a less-than-ideal user experience, such as unexpected updates while editing or replacing text within search matches.

Currently, users have control over when to update the search results (e.g., by retyping or pressing enter), which strikes a good balance between responsiveness and performance. If we see a strong user need for live-updating search in the future, we can definitely revisit this.

@raclim raclim closed this as completed Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants