Repository navigation
fix(react-router): forward NavigateOptions through RouterProvider's navigator - #15781
Merged
brophdawg11 merged 3 commits intoNov 19, 2026
Merged
brophdawg11 merged 3 commits into
brophdawg11 merged 3 commits into
Conversation
…avigator Inside descendant <Routes> under <RouterProvider>, useNavigate() uses useNavigateUnstable(), which calls navigator.push(path, options.state, options) and navigator.replace(path, options.state, options). RouterProvider's navigator only forwarded state and preventScrollReset, dropping mask, defaultShouldRevalidate, flushSync, viewTransition, and relative. Forward opts to router.navigate() while keeping push/replace semantics and explicit state arguments intact. Fixes remix-run#15780
Cover useSearchParams forwarding and navigator history/state precedence, and clarify the release note.
brophdawg11
approved these changes
Nov 19, 2026
brophdawg11
left a comment
Contributor
There was a problem hiding this comment.
Reviewed head 89156cbe0ce00a81dca6efa08a91894048558366 after the main update. The scoped patch matches the previously reviewed fix and standalone regressions; I rechecked its interaction with the updated navigation callers and router validation. No blocking findings. Merge remains gated on current-head CI.
Authored by an AI agent on behalf of @brophdawg11
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.
Fixes #15780
Inside a descendant
<Routes>rendered under<RouterProvider>(or<HydratedRouter>in Framework Mode),IsDataRouteContextisfalse, souseNavigate()(used by<Link>,<NavLink>, anduseSearchParams()) callsuseNavigateUnstable(), which invokesnavigator.push(path, options.state, options)ornavigator.replace(path, options.state, options).<RouterProvider>'snavigatorinpackages/react-router/lib/components.tsxonly forwardedstateandpreventScrollReset:so
mask,defaultShouldRevalidate,flushSync,viewTransition, andrelativewere dropped. For example,<Link to="/gallery?photo=1" mask="/images/1">inside a descendant<Routes>rendered<a href="/images/1">, yet clicking it leftlocation.maskasundefinedand navigated the URL bar to/gallery?photo=1, anddefaultShouldRevalidate={false}still revalidated active data route loaders.This spreads
optsintorouter.navigate(to, ...)while preservingreplace(opts?.replace === false ? false : undefinedforpush,trueforreplace) and giving an explicitstateargument precedence when defined:Tests: new unit test in
packages/react-router/__tests__/dom/data-browser-router-test.tsx(runs under both<DataBrowserRouter>and<DataHashRouter>), verifyingdefaultShouldRevalidate: false,mask,flushSync, andviewTransitionacross<Link>anduseNavigate({ replace: true })inside a descendant<Routes>. Fails onmain:and passes with this change. Also run locally on Windows 11 with Node 24.22.1:
pnpm test packages/react-router/__tests__/dom/data-browser-router-test.tsx packages/react-router/__tests__/descendant-routes-splat-matching-test.tsx packages/react-router/__tests__/descendant-routes-params-test.tsx: 3 suites, 355 passednpx tsc --noEmitinpackages/react-router: cleanpnpm exec eslintandpnpm exec prettier --checkon changed files: cleanpnpm changes:validate: validpnpm run --filter react-router buildand the standalone script from <RouterProvider> drops mask, defaultShouldRevalidate, flushSync, and viewTransition for navigations inside descendant <Routes> #15780 againstdist/production/index.js:loaderCallsstays0,location.maskandwindow.location.pathnamematch/images/1and/images/2, andflushSyncandstartViewTransitionare calledAI-assisted: drafted with an AI coding agent; the tests above were run locally.