@tanstack/solid-db 0.2.14 → 0.2.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-db",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "Solid 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
  "solid",
16
- "typescript"
16
+ "typescript",
17
+ "tanstack-intent"
17
18
  ],
18
19
  "type": "module",
19
20
  "main": "dist/esm/index.js",
@@ -36,13 +37,13 @@
36
37
  ],
37
38
  "dependencies": {
38
39
  "@solid-primitives/map": "^0.7.2",
39
- "@tanstack/db": "0.6.0"
40
+ "@tanstack/db": "0.6.2"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "solid-js": ">=1.9.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@electric-sql/client": "^1.5.13",
46
+ "@electric-sql/client": "^1.5.14",
46
47
  "@solidjs/testing-library": "^0.8.10",
47
48
  "@vitest/coverage-istanbul": "^3.2.4",
48
49
  "jsdom": "^27.4.0",
@@ -10,7 +10,7 @@ description: >
10
10
  type: framework
11
11
  library: db
12
12
  framework: solid
13
- library_version: '0.5.30'
13
+ library_version: '0.6.0'
14
14
  requires:
15
15
  - db-core
16
16
  sources:
@@ -52,12 +52,12 @@ function TodoList() {
52
52
 
53
53
  ### useLiveQuery
54
54
 
55
- Returns an `Accessor<Array<T>>` with additional properties. Call it as a function to get data:
55
+ Returns an `Accessor<Array<T>>` (or `Accessor<T | undefined>` with `findOne`) with additional properties. Call it as a function to get data:
56
56
 
57
57
  ```tsx
58
58
  // Query function — call result as function for data
59
59
  const query = useLiveQuery((q) => q.from({ todo: todoCollection }))
60
- // query() → Array<T> (data)
60
+ // query() → Array<T> (data) — or T | undefined when using findOne()
61
61
  // query.data → DEPRECATED — use query() instead. Migrate any existing code.
62
62
  // query.status → CollectionStatus
63
63
  // query.isLoading, query.isReady, query.isError
@@ -112,6 +112,22 @@ const query = useLiveQuery((q) =>
112
112
  )
113
113
  ```
114
114
 
115
+ ### findOne (single result)
116
+
117
+ When the query uses `.findOne()`, `useLiveQuery` returns a single object (or `undefined`) instead of an array:
118
+
119
+ ```tsx
120
+ const userQuery = useLiveQuery((q) =>
121
+ q
122
+ .from({ user: usersCollection })
123
+ .where(({ user }) => eq(user.id, userId()))
124
+ .findOne(),
125
+ )
126
+
127
+ // userQuery() → T | undefined (not Array<T>)
128
+ return <Show when={userQuery()}>{(user) => <div>{user().name}</div>}</Show>
129
+ ```
130
+
115
131
  ### Suspense integration
116
132
 
117
133
  ```tsx