Skip to content

refactor(router-devtools-core): restore visibility into internalized cached and pending matches#6674

Open
Sheraff wants to merge 3 commits intorefactor-router-core-remove-cached-from-storefrom
refactor-router-devtools-core-restore-cached-pending-matches
Open

refactor(router-devtools-core): restore visibility into internalized cached and pending matches#6674
Sheraff wants to merge 3 commits intorefactor-router-core-remove-cached-from-storefrom
refactor-router-devtools-core-restore-cached-pending-matches

Conversation

@Sheraff
Copy link
Contributor

@Sheraff Sheraff commented Feb 15, 2026

after having internalized pendingMatches and cachedMatches (#6673), they are not accessible outside of router-core anymore.

This PR restores the devtools visibility into those matches by exposing them as a separate store, that will not have the overhead of being consumed throughout the app.

In a follow-up PR, we can further reduce the overhead of reactivity by using createServerStore instead of actual tanstack/store when not running on the client, or not running in dev mode.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-router-devtools-core-restore-cached-pending-matches

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Feb 15, 2026

View your CI Pipeline Execution ↗ for commit 03e62e5

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 9m 28s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 20s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-15 21:03:02 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 15, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6674

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6674

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6674

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6674

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6674

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6674

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6674

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6674

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6674

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6674

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6674

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6674

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6674

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6674

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6674

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6674

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6674

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6674

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6674

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6674

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6674

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6674

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6674

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6674

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6674

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6674

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6674

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6674

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6674

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6674

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6674

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6674

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6674

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6674

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6674

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6674

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6674

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6674

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6674

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6674

commit: 03e62e5

Copy link
Member

@SeanCassiere SeanCassiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're storing Reactive matches in a separate Store, I wonder if it makes sense to take Form's approach of exposing that store and using useStore for subscription to be documented.

const routerInternalPendingMatches = useStore(router.internalReactiveStore, s => s.pendingMatches);

This has the added benefit of providing a migration path for the dozens of users who were accessing the pending matches. We can say that, based on your use case, you should probably be just checking the status === 'pending', but if you absolutely need the pending and cached matches then you'll need to do this "extra legwork" to access it instead.

@Sheraff
Copy link
Contributor Author

Sheraff commented Feb 15, 2026

If we're storing Reactive matches in a separate Store, I wonder if it makes sense to take Form's approach of exposing that store and using useStore for subscription to be documented.

const routerInternalPendingMatches = useStore(router.internalReactiveStore, s => s.pendingMatches);

This has the added benefit of providing a migration path for the dozens of users who were accessing the pending matches. We can say that, based on your use case, you should probably be just checking the status === 'pending', but if you absolutely need the pending and cached matches then you'll need to do this "extra legwork" to access it instead.

That's a good point. I do like keeping stuff "private" / "internal" for more freedom for us, but if some people do actually use those things, we could mention it in the docs

@Sheraff
Copy link
Contributor Author

Sheraff commented Feb 15, 2026

If we're storing Reactive matches in a separate Store, I wonder if it makes sense to take Form's approach of exposing that store and using useStore for subscription to be documented.

const routerInternalPendingMatches = useStore(router.internalReactiveStore, s => s.pendingMatches);

This has the added benefit of providing a migration path for the dozens of users who were accessing the pending matches. We can say that, based on your use case, you should probably be just checking the status === 'pending', but if you absolutely need the pending and cached matches then you'll need to do this "extra legwork" to access it instead.

This would prevent an optimisation I was planning though: to not actually use a reactive store outside of NODE_ENV === 'development'. But then maybe w/ alien-signals (and in a case of zero subscribers) this wouldn't actually make a difference? I was planning on using createServerStore for prod, which is basically a pass-through store: same API, no reactivity.

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.

2 participants