Skip to content

Commit 0b59f3d

Browse files
committed
Fixes
1 parent e8d7a39 commit 0b59f3d

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

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

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ authors:
1212

1313
If you’ve ever muttered “**why is this still so hard in 2025?**”—same.
1414

15-
TanStack DB is our answer: a client-side database layer powered by differential dataflow. It plugs straight into your existing useQuery calls.
15+
TanStack DB is our answer: a client-side database layer powered by differential dataflow that plugs straight into your existing useQuery calls.
1616

1717
It recomputes only what changed—**0.3 ms to update one row in a 100k collection** on an M1 Pro
1818

@@ -79,11 +79,11 @@ One early-alpha adopter, building a Linear-like application, swapped out a pile
7979

8080
Today most teams face an ugly fork in the road:
8181

82-
A. **View-specific endpoints** (fast render, slow network, endless endpoint sprawl) or
82+
**Option A. View-specific APIs** (fast render, slow network, endless endpoint sprawl) or
8383

84-
B. **Load-everything-and-filter** (simple backend, sluggish client).
84+
**Option B. Load-everything-and-filter** (simple backend, sluggish client).
8585

86-
Differential dataflow unlocks **OptionC**—load normalized collections once, let TanStack DB stream millisecond-level incremental joins in the browser. No rewrites, no spinners, no jitter.
86+
Differential dataflow unlocks **Option C**—load normalized collections once, let TanStack DB stream millisecond-level incremental joins in the browser. No rewrites, no spinners, no jitter.
8787

8888
**Live queries, effortless optimistic writes, and a radically simpler architecture**—all incrementally adoptable.
8989

@@ -264,15 +264,15 @@ But it doesn’t just improve your current architecture — it enables a new rad
264264

265265
## TanStack DB enables a radically simplified architecture
266266

267-
If you're using TanStack Query, you've probably hit this architectural fork:
267+
Let's revisit the three options:
268268

269269
**Option A — View-Specific APIs**: Create view-specific API endpoints that return exactly what each component needs. Clean, fast, zero client-side processing. But now you're drowning in brittle API routes, dealing with network waterfalls when components need related data, and creating tight coupling between your frontend views and backend schemas.
270270

271-
**Option B — Load and Filter Client-Side**: Load broader datasets and filter/process them client-side. Fewer API calls, more flexible frontend. But you slam into the performance wall — `todos.filter()`, `users.find()`, `posts.map()`, `useMemo()` everywhere, with cascading re-renders destroying your UX.
271+
**Option B — Load-everything-and-filter**: Load broader datasets and filter/process them client-side. Fewer API calls, more flexible frontend. But you slam into the performance wall — `todos.filter()`, `users.find()`, `posts.map()`, `useMemo()` everywhere, with cascading re-renders destroying your UX.
272272

273273
Most teams pick Option A to avoid performance problems. You're trading client-side complexity for API proliferation and network dependency.
274274

275-
**TanStack DB enables Option C – Normalized Collections + Incremental Joins (TanStack DB):** Load normalized collections through fewer API calls, then perform lightning-fast incremental joins in the client. You get the network efficiency of broad data loading with sub-millisecond query performance that makes Option A unnecessary.
275+
**TanStack DB enables Option C – Normalized Collections + Incremental Joins:** Load normalized collections through fewer API calls, then perform lightning-fast incremental joins in the client. You get the network efficiency of broad data loading with sub-millisecond query performance that makes Option A unnecessary.
276276

277277
Instead of this:
278278

@@ -301,23 +301,19 @@ const projectCollection = createQueryCollection({
301301
})
302302

303303
// Navigation is instant — no new API calls needed
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),
304+
const { data: activeProjectTodos } = useLiveQuery((q) =>
305+
q
306+
.from({ t: todoCollection })
307+
.innerJoin(
308+
{ u: userCollection },
309+
({ t, u }) => eq(t.userId, u.id)
310+
)
311+
.innerJoin(
312+
{ p: projectCollection },
313+
({ u, p }) => eq(u.projectId, p.id)
314+
)
315+
.where(({ t }) => eq(t.active, true))
316+
.where(({ p }) => eq(p.id, currentProject.id))
321317
)
322318
```
323319

0 commit comments

Comments
 (0)