Skip to content

Commit dc8c525

Browse files
committed
opus review
1 parent 81c266a commit dc8c525

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ TanStack Router used to center most of its reactivity around one large object: `
1414

1515
This builds on TanStack Store's migration to [alien-signals](https://github.com/stackblitz/alien-signals) in [TanStack Store PR #265](https://github.com/TanStack/store/pull/265), implemented by [@DavidKPiano](https://github.com/davidkpiano). In external benchmarks like [js-reactivity-benchmark](https://github.com/transitive-bullshit/js-reactivity-benchmark), alien-signals is currently the best-performing signals implementation tested. But the main improvement here is not just a faster primitive. It is a different reactive model.
1616

17-
The result is
17+
The result is
1818
- better update locality,
1919
- fewer store updates during navigation,
2020
- substantially faster client-side navigation,
@@ -39,9 +39,7 @@ This did not mean every update rerendered everything. Options like `select` and
3939

4040
Routing is not one thing that changes all at once. A navigation changes specific pieces of state with specific relationships: one match stays active, another becomes pending, one link flips state, some cached matches do not change at all.
4141

42-
The old model captured those pieces of state, but it flattened them into one main subscription surface. That was the mismatch.
43-
44-
This is where the mismatch becomes visible:
42+
The old model captured those pieces of state, but it flattened them into one main subscription surface. This is where the mismatch becomes visible:
4543

4644
<figure>
4745
<video src="/blog-assets/tanstack-router-signal-graph/before-router-state-blob.mp4" playsinline loop autoplay muted></video>
@@ -69,7 +67,7 @@ The new picture looks like this:
6967
<figure>
7068
<video src="/blog-assets/tanstack-router-signal-graph/after-granular-store-graph.mp4" playsinline loop autoplay muted></video>
7169
<figcaption>
72-
A video showing that on stateful event in the core of the router, only specific subset of subscribers are updated in the application.
70+
A video showing that on each stateful event in the core of the router, only a specific subset of subscribers are updated in the application.
7371
</figcaption>
7472
</figure>
7573

@@ -88,7 +86,10 @@ Before this refactor, `useMatch` subscribed through the big router store and the
8886
```ts
8987
// Before
9088
useRouterState({
91-
select: (state) => state.matches.find(/* route or match lookup */),
89+
select: (state) => {
90+
const match = state.matches.find((m) => m.routeId === routeId)
91+
/* select from one match */
92+
}
9293
})
9394

9495
// After
@@ -204,7 +205,6 @@ This graph shows the duration of 10 navigations going from 120ms on <code>main</
204205
205206
#### Vue
206207
207-
208208
<figure>
209209
<img src="/blog-assets/tanstack-router-signal-graph/client-side-nav-vue.png" alt="">
210210
<figcaption>

0 commit comments

Comments
 (0)