Skip to content

perf: avoid unnecessary data router re-renders - #15376

Draft
brophdawg11 wants to merge 6 commits into
mainfrom
brophdawg11/codex-stable-route-id-context
Draft

perf: avoid unnecessary data router re-renders#15376
brophdawg11 wants to merge 6 commits into
mainfrom
brophdawg11/codex-stable-route-id-context

Conversation

@brophdawg11

@brophdawg11 brophdawg11 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Reduce unnecessary Data and Framework Mode route component re-renders by separating route IDs, active router state, route data, pending navigation state, and fetcher state into stable React contexts.

  • Keep parent route components stable when only a descendant location changes.
  • Avoid notifying useLoaderData consumers when no loader data changed.
  • Avoid notifying active-state consumers when navigation enters a pending state, while preserving updates for useNavigation, useRevalidator, NavLink, and unstable_useRouterState.
  • Avoid notifying useMatches and useRoute consumers when fetchers update, while preserving updates for useFetcher and useFetchers.

Assisted-By: devx/09e6ec2a-279b-4e17-8759-2626d088d051
Assisted-By: devx/f6fc68e3-b7d8-4cad-848e-5b04c955db56
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Preview Build Available

Preview builds have been created for this PR. You can install react-router using:

pnpm install "remix-run/react-router#preview/pr-15376&path:packages/react-router"

And/or install other packages via:

pnpm install "remix-run/react-router#preview/pr-15376&path:packages/react-router-dev"
pnpm install "remix-run/react-router#preview/pr-15376&path:packages/react-router-express"
pnpm install "remix-run/react-router#preview/pr-15376&path:packages/react-router-node"
pnpm install "remix-run/react-router#preview/pr-15376&path:packages/react-router-serve"

These preview builds will be updated automatically as you push new commits.

Assisted-By: devx/755516d2-c45b-45bf-b52b-d964afb579bb
Assisted-By: devx/755516d2-c45b-45bf-b52b-d964afb579bb
Assisted-By: devx/755516d2-c45b-45bf-b52b-d964afb579bb
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ CLA Signed

Thanks for signing the Contributor License Agreement.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Change File Found

One or more change files found.

Type Change
patch Avoid unnecessary route component re-renders when unrelated data router state changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant