Skip to content

Reduce delay before API notice and trending landing search - #466

Merged
xenodus merged 2 commits into
masterfrom
cursor/trending-bootstrap-latency-210a
Sep 10, 2026
Merged

xenodus merged 2 commits into
masterfrom
cursor/trending-bootstrap-latency-210a

Conversation

@xenodus

@xenodus xenodus commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

Trending links (/?s=...) and the API notice banner were delayed because Turnstile script load, session mint, and landing search all ran sequentially after React hydration.

This PR overlaps that work with app startup and decouples the notice banner from Turnstile:

  • Early bootstrapmain.jsx calls preloadTurnstile() and ensureApiSession() before createRoot().render(), so Turnstile + /session run in parallel with React hydration.
  • Notice before Turnstile — New GET /session?statusOnly=1 returns notice/maintenance without Turnstile or cookie minting. fetchSiteStatus() runs first in main.jsx so the banner can render as soon as the lightweight probe returns.
  • Turnstile preload — Loads the script and pre-renders the invisible widget; index.html adds a <link rel="preload"> for the Turnstile script.
  • Faster landing search?s= search fires directly in the bootstrap .then() callback instead of waiting for a separate sessionBootstrapped effect.

Testing

  • make test — pass
  • go test ./handler/... -run TestSession_StatusOnly — pass
  • Manual: http://localhost:5173/?s=Opt auto-initiates search on load

Privacy policy

No change — no new data collection.

UI

No visual changes; perceived latency improvement only. Notice banner now appears independently of Turnstile/session timing.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 10, 2026 17:26
Start Turnstile preload and session bootstrap in main.jsx before React
hydration so trending ?s= links overlap challenge/network work with app
startup. Pre-render the invisible widget, preload the Turnstile script in
index.html, cache bootstrap timing for immediate notice display, and trigger
landing search directly in the bootstrap callback instead of waiting for a
follow-up effect.

Co-authored-by: xenodus <xenodus@gmail.com>
Add GET /session?statusOnly=1 to return notice and maintenance without
Turnstile or cookie minting. Fetch site status from main.jsx on load so
the notice banner renders immediately, independent of session bootstrap.

Co-authored-by: xenodus <xenodus@gmail.com>
@xenodus
xenodus marked this pull request as ready for review September 10, 2026 17:29
@xenodus
xenodus merged commit 5e81662 into master Sep 10, 2026
3 checks passed
@xenodus
xenodus deleted the cursor/trending-bootstrap-latency-210a branch September 10, 2026 17:29
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