Skip to content

Show searching state immediately on trending landing URLs - #467

Merged
xenodus merged 1 commit into
masterfrom
cursor/fast-landing-search-button-b287
Sep 10, 2026
Merged

xenodus merged 1 commit into
masterfrom
cursor/fast-landing-search-button-b287

Conversation

@xenodus

@xenodus xenodus commented Sep 10, 2026

Copy link
Copy Markdown
Owner

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

useSearch waited for ensureApiSession() (including Turnstile) to resolve before calling performSearch for ?s= landing URLs. During that wait the button stayed on Search, even though a search was about to start.

Solution

  • Call runLandingSearchIfNeeded() at the start of the mount effect, using any cached site status for maintenance checks.
  • performSearch already awaits ensureApiSession() before the API request, so Turnstile still runs in the correct place — we just show searching UI while it does.
  • Remove the duplicate landing-search trigger from the ensureApiSession().then(...) path (the landingSearchHandledRef guard prevents double searches).
  • If maintenance mode is known before search starts, clear the searching state and show the maintenance error instead.

Verification

Playwright check with a 3s delayed /session response on /?s=Opt:

  • #searchBtn text: Searching LGS
  • Button disabled: true

Landing search shows Searching LGS while session bootstrap is in progress

make test passed.

Privacy policy

No change — no new data collection.

Open in Web Open in Cursor 

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>
@xenodus
xenodus marked this pull request as ready for review September 10, 2026 17:51
@xenodus
xenodus merged commit 0d03900 into master Sep 10, 2026
4 checks passed
@xenodus
xenodus deleted the cursor/fast-landing-search-button-b287 branch September 10, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants