Show searching state immediately on trending landing URLs - #467
Merged
Merged
Conversation
Start the landing-page search as soon as useSearch mounts instead of waiting for Turnstile/session bootstrap to finish. performSearch already awaits ensureApiSession internally, so the search button and skeletons appear while Turnstile runs. Co-authored-by: xenodus <xenodus@gmail.com>
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.
Summary
When a user lands on a search URL (for example from a trending pill), the search button and skeleton loaders now enter the searching state immediately on mount, instead of waiting for Turnstile/session bootstrap to finish first.
Problem
useSearchwaited forensureApiSession()(including Turnstile) to resolve before callingperformSearchfor?s=landing URLs. During that wait the button stayed on Search, even though a search was about to start.Solution
runLandingSearchIfNeeded()at the start of the mount effect, using any cached site status for maintenance checks.performSearchalready awaitsensureApiSession()before the API request, so Turnstile still runs in the correct place — we just show searching UI while it does.ensureApiSession().then(...)path (thelandingSearchHandledRefguard prevents double searches).Verification
Playwright check with a 3s delayed
/sessionresponse on/?s=Opt:#searchBtntext: Searching LGSmake testpassed.Privacy policy
No change — no new data collection.