@tanstack/react-db 0.1.78 → 0.1.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/skills/react-db/SKILL.md +24 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.79",
|
|
4
4
|
"description": "React integration for @tanstack/db",
|
|
5
5
|
"author": "Kyle Mathews",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"keywords": [
|
|
14
14
|
"optimistic",
|
|
15
15
|
"react",
|
|
16
|
-
"typescript"
|
|
16
|
+
"typescript",
|
|
17
|
+
"tanstack-intent"
|
|
17
18
|
],
|
|
18
19
|
"type": "module",
|
|
19
20
|
"main": "dist/cjs/index.cjs",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
],
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"use-sync-external-store": "^1.6.0",
|
|
43
|
-
"@tanstack/db": "0.6.
|
|
44
|
+
"@tanstack/db": "0.6.1"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"react": ">=16.8.0"
|
package/skills/react-db/SKILL.md
CHANGED
|
@@ -13,7 +13,7 @@ description: >
|
|
|
13
13
|
type: framework
|
|
14
14
|
library: db
|
|
15
15
|
framework: react
|
|
16
|
-
library_version: '0.
|
|
16
|
+
library_version: '0.6.0'
|
|
17
17
|
requires:
|
|
18
18
|
- db-core
|
|
19
19
|
sources:
|
|
@@ -168,6 +168,28 @@ const mutate = usePacedMutations({
|
|
|
168
168
|
<textarea onChange={(e) => mutate(e.target.value)} />
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
## Virtual Properties
|
|
172
|
+
|
|
173
|
+
Live query results include computed, read-only virtual properties on every row:
|
|
174
|
+
|
|
175
|
+
- `$synced`: `true` when the row is confirmed by sync; `false` when it is still optimistic.
|
|
176
|
+
- `$origin`: `"local"` if the last confirmed change came from this client, otherwise `"remote"`.
|
|
177
|
+
- `$key`: the row key for the result.
|
|
178
|
+
- `$collectionId`: the source collection ID.
|
|
179
|
+
|
|
180
|
+
These props are added automatically and can be used in `where`, `select`, and `orderBy` clauses. Do not persist them back to storage.
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
const { data } = useLiveQuery(
|
|
184
|
+
(q) =>
|
|
185
|
+
q
|
|
186
|
+
.from({ todo: todoCollection })
|
|
187
|
+
.where(({ todo }) => eq(todo.$synced, false)),
|
|
188
|
+
[],
|
|
189
|
+
)
|
|
190
|
+
// Shows only optimistic (unconfirmed) todos
|
|
191
|
+
```
|
|
192
|
+
|
|
171
193
|
## React-Specific Patterns
|
|
172
194
|
|
|
173
195
|
### Dependency arrays
|
|
@@ -284,7 +306,7 @@ If multiple versions appear, fix with one of:
|
|
|
284
306
|
{
|
|
285
307
|
"pnpm": {
|
|
286
308
|
"overrides": {
|
|
287
|
-
"@tanstack/db": "^0.
|
|
309
|
+
"@tanstack/db": "^0.6.0"
|
|
288
310
|
}
|
|
289
311
|
}
|
|
290
312
|
}
|