Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renders the app with createBrowserRouter/RouterProvider instead of BrowserRouter. Route loaders preload the page chunks, replacing the PendingNavigation component, and the new useRouter() hook lets theme utils subscribe to the router state with useSyncExternalStore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +70.1 kB (+0.58%) Total Size: 12.1 MB 📦 View Changed
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: +70.8 kB (+0.59%) Total Size: 12.1 MB 📦 View Changed
ℹ️ View Unchanged
|
This branch has not been deployed
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.
Breaking Changes
Same as #12807: this prototype builds on its React Router v8 upgrade. Data mode adds no breaking change of its own.
Motivation
#12807 upgrades React Router in declarative mode (
BrowserRouter). The location lives in a React context there, souseLocation()consumers re-render on every navigation, anduseHistorySelector()can't useuseSyncExternalStoreanymore.This draft prototypes data mode (
createBrowserRouter+RouterProvider) on top of it, to evaluate how much more complex it is. Delta with #12807: 17 files, +391/−181, tests included.What data mode simplifies
PendingNavigationis gone: route loaders preload the page chunks, and the router keeps rendering the current page until they resolve. On the server,createStaticHandler().query()runs the same loaders.useSyncExternalStoreagain: the newuseRouter()hook of@docusaurus/routerreturns the router instance, without re-rendering on navigations.useHistorySelector()subscribes withrouter.subscribe, souseQueryStringValue()only re-renders when its value changes. The query-string updaters readrouter.statewhen called, so they are stable callbacks.useBlocker()restoresuseHistoryPopHandler(). The mobile sidebar closes on back navigation and stays on the page, like on main.skipToContentreadsrouter.state.historyAction, like main readshistory.action.What data mode makes harder
.htmlURLs (hosts without clean URLs): the router only renders the URL location.patchRoutesOnNavigationadds a route for these paths that preloads the clean path, andApprenders the clean path with a descendantuseRoutes(routes, normalizedLocation).onRouteUpdateis dispatched from arouter.subscribe()listener, outside React.useRouter()with a memory router.main.jsships the data router code, +19 kB gzip (see Benchmark).Benchmark
main.jsofpnpm build:website:fast:Test Plan
.htmlroutes patchpnpm build:website:fast), checked locally:.htmlURL served by a static server without clean URLs: renders the page, then navigates and goes back/feature-requestsrouteTest links
Deploy preview: https://deploy-preview-12820--docusaurus-2.netlify.app/
Related issues/PRs
🤖 Generated with Claude Code