Skip to content

Commit c76d9d6

Browse files
committed
feature(examples): add kitchen sink example WIP
1 parent 72b561a commit c76d9d6

File tree

38 files changed

+2836
-442
lines changed

38 files changed

+2836
-442
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"tangrams": patch
3+
---
4+
5+
Fix predicate translator imports and offset access in generated db collections
6+
7+
- Import `LoadSubsetOptions` type from `@tanstack/db` instead of `@tanstack/query-db-collection` where it is not exported
8+
- Access `offset` from the original `options` object rather than from `parseLoadSubsetOptions()` return value, which only returns `{ filters, sorts, limit }`

apps/docs/content/docs/tanstack-db.mdx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,35 @@ Tangrams automatically detects the appropriate predicate mapping preset by analy
519519

520520
You only need to specify `predicateMapping` if you want to override the auto-detected preset.
521521

522+
### Additional Peer Dependency for On-Demand Mode
523+
524+
When using on-demand sync mode, you also need `@tanstack/db` for the `LoadSubsetOptions` type:
525+
526+
<Tabs items={['bun', 'npm', 'pnpm']}>
527+
<Tab value="bun">
528+
```bash
529+
bun add @tanstack/db
530+
```
531+
</Tab>
532+
<Tab value="npm">
533+
```bash
534+
npm install @tanstack/db
535+
```
536+
</Tab>
537+
<Tab value="pnpm">
538+
```bash
539+
pnpm add @tanstack/db
540+
```
541+
</Tab>
542+
</Tabs>
543+
522544
### Generated On-Demand Collection
523545

524546
When on-demand mode is enabled, the generated collection includes a predicate translator function:
525547

526548
```typescript
527549
import { parseLoadSubsetOptions } from "@tanstack/query-db-collection"
528-
import type { LoadSubsetOptions } from "@tanstack/query-db-collection"
550+
import type { LoadSubsetOptions } from "@tanstack/db"
529551

530552
function translateProductPredicates(
531553
options?: LoadSubsetOptions

bun.lock

Lines changed: 65 additions & 425 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ All examples are TanStack Start applications that demonstrate various combinatio
1919
| `start-openapi-query` | OpenAPI | `["query"]` | SSR | Basic OpenAPI/REST with TanStack Query |
2020
| `start-openapi-form` | OpenAPI | `["query", "form"]` | SSR | OpenAPI + TanStack Form validation |
2121
| `start-openapi-db` | OpenAPI | `["db"]` | SPA | Local-first with full sync |
22+
| `start-graphql-db` | OpenAPI | `["db"]` | SPA | Local-first with full sync |
2223
| `start-multi-source` | Both | `["query", "form"]` | SSR | Multiple data sources in one app |
2324
| `start-full-stack` | OpenAPI | `["query", "form", "db"]` | SPA | All generators combined |
2425

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "start-full-stack",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "vite dev",
7+
"build": "vite build",
8+
"start": "node .output/server/index.mjs",
9+
"generate": "tangrams generate"
10+
},
11+
"dependencies": {
12+
"@better-fetch/fetch": "^1.1.16",
13+
"@tanstack/db": "^0.5.12",
14+
"@tanstack/query-db-collection": "^1.0.8",
15+
"@tanstack/react-db": "^0.1.56",
16+
"@tanstack/react-devtools": "^0.8.4",
17+
"@tanstack/react-form": "^1.27.4",
18+
"@tanstack/react-query": "^5.80.7",
19+
"@tanstack/react-query-devtools": "^5.80.7",
20+
"@tanstack/react-router": "^1.121.0",
21+
"@tanstack/react-router-devtools": "^1.121.0",
22+
"@tanstack/react-start": "^1.121.0",
23+
"react": "^19.1.0",
24+
"react-dom": "^19.1.0",
25+
"zod": "^4.2.1"
26+
},
27+
"devDependencies": {
28+
"@examples/shared": "workspace:*",
29+
"@tailwindcss/vite": "^4.1.8",
30+
"@tanstack/devtools-vite": "^0.3.12",
31+
"@types/react": "^19.1.6",
32+
"@types/react-dom": "^19.1.5",
33+
"@vitejs/plugin-react": "^4.5.2",
34+
"tailwindcss": "^4.1.8",
35+
"tangrams": "workspace:*",
36+
"typescript": "^5.8.3",
37+
"vite": "^7.2.7",
38+
"vite-tsconfig-paths": "^5.1.4"
39+
},
40+
"msw": {
41+
"workerDirectory": [
42+
"public"
43+
]
44+
}
45+
}

0 commit comments

Comments
 (0)