Repository navigation
fix(theme/Search): await FlexSearch addAsync before init resolves - #3678
Merged
SoonIter merged 2 commits intoSep 14, 2026
Merged
Conversation
SoonIter
enabled auto-merge (squash)
September 14, 2026 06:01
Contributor
Author
|
Thanks for reviewing and merging #3678, and for maintaining Rspress. This was an interesting race condition where I’m glad we could address it with a focused fix while preserving existing behavior. Thanks again for the review and for the opportunity to contribute to Rspress! |
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.
Motivation
LocalProvider.init()issuesaddAsync()on the three FlexSearch indexes for every page but never awaits the returned promises.SearchPanel.initSearch()awaitsinit()and setsinitStatusto'inited'while indexing is still running, so on a medium site a query typed shortly after opening search can render "No matching results" until the user retypes. This reproduces with 952 documents per locale, as described in #3658.Changes
Collect the
addAsync()promises for each page's three indexes into a pending array andawait Promise.all(pending)beforeinit()resolves. The panel therefore keeps its loading state until the index is ready and then runs the pending query. No other behavior changes.Related to #1725
Fixes #3658
Verification
tsc --noEmitonpackages/corepasses.