Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: +10.2 kB (+0.08%) Total Size: 12.1 MB 📦 View Changed
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: +10.4 kB (+0.09%) 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
Docusaurus upgrades from React Router v5 to React Router v8. It only uses declarative mode APIs that v6, v7 and v8 share. Sites that don't use the router APIs directly are not affected. For custom code, React Router's Upgrading from v5 guide applies.
@docusaurus/routernow re-exportsuseLocation,useNavigate,Navigate,Outlet,matchPathand theLocationtype:useHistory()is removed: useuseNavigate().history.push(to)becomesnavigate(to),history.replace(to)becomesnavigate(to, {replace: true}), andhistory.locationbecomesuseLocation().<Redirect to="/x" />is removed: use<Navigate to="/x" replace />.matchPath(pathname, {path, exact})becomesmatchPath({path, end: exact}, pathname).history.block()) has no replacement: declarative mode doesn't support it.@docusaurus/renderRoutesis removed: render subroutes with<Outlet />from@docusaurus/router. This affects swizzledDocsRootandDocVersionRootcomponents.routeprop: use theuseLocation()hook instead of thelocation,matchandhistoryprops.addRoute()):strictoption is removed: routes always match with or without a trailing slash.routes) only render when one of their subroutes matches.exactkeeps working: routes withoutexact: truestill match their subpaths.<Link>: theactiveStyle,innerRefandstrictprops are removed. UseactiveClassNameandrefinstead. TheisActivecallback receives React Router's newPathMatchtype.useHistorySelector()(@docusaurus/theme-common): the selector receives{location}instead of the history object.Motivation
React Router v5 is no longer maintained. Upgrading also removes
react-router-dom,react-router-config,historyand their@typespackages.Previous attempts (#12201, #12190) needed too many adapters. This PR keeps the Docusaurus route config API and converts it to React Router route objects in one place,
routeObjects.tsx:exactget a/*splat, so that they still match their subpaths. The broken links checker uses the same rule.Other notable changes:
useRoutes(routes, pendingLocation), which replaces the<Route location>trick. Routers useuseTransitions={false}becausePendingNavigationruns its own side effects.<Link>:NavLinkno longer supportsisActive.<a href>does, instead of against the route hierarchy.IntersectionObservermoves to an effect: v8'sLinkmerges refs, so it calls callback refs again on every render.discover="none", to avoid rendering uselessdata-discoverattributes, only used by framework mode.Test Plan
/feature-requestssubpaths still match (non-exact route), and unknown pages render the 404 page.<Link>unit tests).Test links
Deploy preview: https://deploy-preview-12807--docusaurus-2.netlify.app/
Related issues/PRs
history.block(), but sites can't block navigations anymore either.(AI-assisted)
🤖 Generated with Claude Code