Skip to content

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

Merged
brophdawg11 merged 11 commits into
mainfrom
brophdawg11/codex-stable-route-id-context
Sep 2, 2026
Merged

brophdawg11 merged 11 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

Assisted-By: devx/b2552a8f-d5a9-42ae-99b3-bb72dd06a325
Assisted-By: devx/b2552a8f-d5a9-42ae-99b3-bb72dd06a325
@brophdawg11
brophdawg11 marked this pull request as ready for review September 2, 2026 13:21
@brophdawg11
brophdawg11 merged commit 7d3174a into main Sep 2, 2026
12 checks passed
@brophdawg11
brophdawg11 deleted the brophdawg11/codex-stable-route-id-context branch September 2, 2026 14:26
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The preview branch preview/pr-15376 has been deleted now that this PR is merged/closed.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hello there,

We recently published version 8.4.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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