Skip to content

Commit 8995e55

Browse files
committed
cleanup
1 parent 946bc2a commit 8995e55

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/blog/tanstack-router-signal-graph.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Before, the graph was derived from `router.state`. Now, `router.state` is derive
8181

8282
## Hook-Level Change: Subscribe to the Relevant Store
8383

84-
Once the graph becomes the source of truth, hooks can subscribe directly to graph nodes instead of selecting from a broad snapshot. The clearest example is `useMatch`.
84+
Once the graph becomes the source of truth, router internals can subscribe directly to graph nodes instead of selecting from a broad snapshot. The clearest example is `useMatch`.
8585

8686
Before this refactor, `useMatch` subscribed through the big router store and then searched `state.matches` for the match it cared about. Now it resolves the relevant store first and subscribes directly to it.
8787

@@ -99,6 +99,8 @@ const matchStore = router.stores.getMatchStoreByRouteId(routeId)
9999
useStore(matchStore, (match) => /* select from one match */)
100100
```
101101

102+
This is an internal implementation detail, not a new public API surface for application code.
103+
102104
> [!NOTE]
103105
> `getMatchStoreByRouteId` creates a derived signal on demand, and stores it
104106
> in a Least-Recently-Used cache[^lru-cache] so it can be reused by other subscribers
@@ -267,7 +269,7 @@ Routing is a graph. Now the reactivity is one too.
267269
268270
[^alien-bench]: [js-reactivity-benchmark](https://github.com/transitive-bullshit/js-reactivity-benchmark) last updated january 2025
269271
270-
[^store-update-tests]: Methodology and exact scenario assertions live in the adapter test files for [React](https://github.com/TanStack/router/blob/refactor-signals/packages/react-router/tests/store-updates-during-navigation.test.tsx), [Solid](https://github.com/TanStack/router/blob/refactor-signals/packages/solid-router/tests/store-updates-during-navigation.test.tsx), and [Vue](https://github.com/TanStack/router/blob/refactor-signals/packages/vue-router/tests/store-updates-during-navigation.test.tsx).
272+
[^store-update-tests]: Methodology and exact scenario assertions live in the adapter test files for [React](https://github.com/TanStack/router/blob/main/packages/react-router/tests/store-updates-during-navigation.test.tsx), [Solid](https://github.com/TanStack/router/blob/main/packages/solid-router/tests/store-updates-during-navigation.test.tsx), and [Vue](https://github.com/TanStack/router/blob/main/packages/vue-router/tests/store-updates-during-navigation.test.tsx).
271273
272274
[^lru-cache]: For a great JavaScript-oriented explanation of how LRU caches work, see [Implementing an efficient LRU cache in JavaScript](https://yomguithereal.github.io/posts/lru-cache/).
273275

0 commit comments

Comments
 (0)