Skip to content

Commit e8d7a39

Browse files
committed
Add header image
1 parent 1a2624b commit e8d7a39

2 files changed

Lines changed: 34 additions & 34 deletions

File tree

233 KB
Loading

src/blog/tanstack-db-0.1-the-embedded-client-database-for-tanstack-query.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
---
22
title: Stop Re-Rendering — TanStack DB, the Embedded Client Database for TanStack Query
3-
published: 2025-07-28
3+
published: 2025-07-30
44
authors:
55
- Kyle Mathews
66
- Sam Willis
77
---
88

9+
![Stop rerendering](/blog-assets/tanstack-db-0.1/header.png)
10+
11+
**Your React dashboard shouldn't grind to a halt** just because one TODO turns from ☐ to ☑. Yet every optimistic update still kicks off a cascade of re-renders, filters, useMemos and spinner flashes.
12+
13+
If you’ve ever muttered “**why is this still so hard in 2025?**”—same.
14+
15+
TanStack DB is our answer: a client-side database layer powered by differential dataflow. It plugs straight into your existing useQuery calls.
16+
17+
It recomputes only what changed—**0.3 ms to update one row in a 100k collection** on an M1 Pro
18+
19+
One early-alpha adopter, building a Linear-like application, swapped out a pile of MobX code for TanStack DB and told us with relief, “everything is now completely instantaneous when clicking around the app, even w/ 1000s of tasks loaded.”
20+
21+
### Why it matters
22+
923
<style>
1024
.code-comparison {
1125
display: grid;
@@ -63,18 +77,6 @@ authors:
6377
}
6478
</style>
6579

66-
**Your React dashboard shouldn't grind to a halt** just because one TODO turns from ☐ to ☑. Yet every optimistic update still kicks off a cascade of re-renders, filters, useMemos and spinner flashes.
67-
68-
If you’ve ever muttered “**why is this still so hard in 2025?**”—same.
69-
70-
TanStack DB is our answer: a client-side database layer powered by differential dataflow. It plugs straight into your existing useQuery calls.
71-
72-
It recomputes only what changed—**0.3 ms to update one row in a 100k collection** on an M1 Pro
73-
74-
One early-alpha adopter, building a Linear-like application, swapped out a pile of MobX code for TanStack DB and told us with relief, “everything is now completely instantaneous when clicking around the app, even w/ 1000s of tasks loaded.”
75-
76-
### Why it matters
77-
7880
Today most teams face an ugly fork in the road:
7981

8082
A. **View-specific endpoints** (fast render, slow network, endless endpoint sprawl) or
@@ -276,9 +278,8 @@ Instead of this:
276278

277279
```typescript
278280
// View-specific API call every time you navigate
279-
const { data: projectTodos } = useQuery(
280-
['project-todos', projectId],
281-
() => fetchProjectTodosWithUsers(projectId)
281+
const { data: projectTodos } = useQuery(['project-todos', projectId], () =>
282+
fetchProjectTodosWithUsers(projectId),
282283
)
283284
```
284285

@@ -300,24 +301,23 @@ const projectCollection = createQueryCollection({
300301
})
301302

302303
// Navigation is instant — no new API calls needed
303-
const { data: activeProjectTodos } = useLiveQuery(
304-
(query) =>
305-
query
306-
.from({
307-
t: todoCollection,
308-
u: userCollection,
309-
p: projectCollection,
310-
})
311-
.join({
312-
type: 'inner',
313-
on: [`@t.userId`, `=`, `@u.id`],
314-
})
315-
.join({
316-
type: 'inner',
317-
on: [`@u.projectId`, `=`, `@p.id`],
318-
})
319-
.where('@t.active', '=', true)
320-
.where('@p.id', '=', currentProject.id)
304+
const { data: activeProjectTodos } = useLiveQuery((query) =>
305+
query
306+
.from({
307+
t: todoCollection,
308+
u: userCollection,
309+
p: projectCollection,
310+
})
311+
.join({
312+
type: 'inner',
313+
on: [`@t.userId`, `=`, `@u.id`],
314+
})
315+
.join({
316+
type: 'inner',
317+
on: [`@u.projectId`, `=`, `@p.id`],
318+
})
319+
.where('@t.active', '=', true)
320+
.where('@p.id', '=', currentProject.id),
321321
)
322322
```
323323

0 commit comments

Comments
 (0)