refactor(router-devtools-core): restore visibility into internalized cached and pending matches#6674
Conversation
…cached and pending matches
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 03e62e5
☁️ Nx Cloud last updated this comment at |
SeanCassiere
left a comment
There was a problem hiding this comment.
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 |
This would prevent an optimisation I was planning though: to not actually use a reactive store outside of |
after having internalized
pendingMatchesandcachedMatches(#6673), they are not accessible outside ofrouter-coreanymore.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
createServerStoreinstead of actual tanstack/store when not running on the client, or not running in dev mode.