perf(utils): add retry limit to autocomplete setup polling#6635
Merged
walterbender merged 2 commits intoApr 15, 2026
Merged
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Sidharthwin
approved these changes
Apr 15, 2026
Contributor
|
@walterbender LGTM |
Contributor
Author
|
@walterbender Can you please have a look at this when you have time |
Member
|
Might make sense to add a console error message if the max retries is reached and it fails? |
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
Author
|
@walterbender have pushed a new commit that logs a console.error if the initialization fails after hitting MAX_RETRIES |
e-esakman
pushed a commit
to e-esakman/musicblocks
that referenced
this pull request
Apr 16, 2026
…#6635) * perf(utils): add retry limit to autocomplete setup polling * perf(utils): add console error message on retry failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request fixes a performance bug where
jquery-setup.jswould keep polling the DOM forever if the#searchUI autocomplete didn't start up or if the element wasn't on the current page layout.The script safely backs off after 10 seconds of polling by adding a retry upper bound (
MAX_RETRIES = 20). This stops the background from looping forever and saves the user's CPU and memory cycles.Related Issues
Fixes #6634
Changes
js/utils/jquery-setup.js: Introduced aretriestracking variable and aMAX_RETRIESconstant.elseblock to only executesetTimeoutifretries < MAX_RETRIES.How Has This Been Tested?
Checklist
masterbranch.npm run lint.PR Category