fix(docs): theme flash + client-side navigation#217
Conversation
Move theme bootstrap before render-blocking font stylesheet; add critical body background rules; normalize stored theme; reapply on DOMContentLoaded and bfcache pageshow. Co-authored-by: Cursor <cursoragent@cursor.com>
Use ClientRouter for in-site link clicks instead of full document reloads. Reapply theme after view transitions swap root attributes; rebind navbar handlers on astro:page-load; delegate search modal to document listeners; reinit tabs and homepage install block on page-load. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughThe PR refactors interactive components to safely initialize and re-initialize across Astro's client-side navigation. BaseLayout establishes theme and scroll lifecycle; Navbar consolidates interactions with lifecycle-aware listeners; SearchModal moves to delegated document listeners; Tabs and InstallSection register astro:page-load handlers to re-init on navigation. ChangesAstro Lifecycle Navigation Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
prefetch-all plus many doc links caused noisy background fetches and made the tab/URL UI feel like it was constantly updating. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
bodybackground rules, normalizelocalStoragetheme values, reapply onDOMContentLoaded/ bfcachepageshow, and onastro:after-swapso dark mode stays consistent during view transitions.ClientRouterso in-site doc links use client-side navigations instead of a full document reload. Rebind navbar listeners onastro:page-load, use document-level delegation for the search modal, and reinit tabs / homepage install section after navigations.Test plan
npm run dev— dark mode, click many doc sidebar links — no light flash, no full reload feelSummary by CodeRabbit