@tanstack/svelte-db 0.5.8 → 0.5.9
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/dist/useLiveQuery.svelte.js +11 -9
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
// eslint-disable-next-line import/no-duplicates -- See https://github.com/un-ts/eslint-plugin-import-x/issues/308
|
|
4
4
|
import { SvelteMap } from 'svelte/reactivity';
|
|
5
|
-
import { BaseQueryBuilder, UnhashableQueryIRError, createLiveQueryCollection, createLiveQueryObserver, getLiveQueryHash, getPublicCollection, getStableValueHash, isCollection, isSingleResultCollection, prepareLiveQueryValue, resolveLiveQueryValue, } from '@tanstack/db';
|
|
5
|
+
import { BaseQueryBuilder, UnhashableQueryIRError, createLiveQueryCollection, createLiveQueryObserver, getLiveQueryHash, getPublicCollection, getStableValueHash, isCollection, isSingleResultCollection, prepareLiveQueryValue, resolveLiveQueryValue, resumeDeferredLiveQueryCollections, } from '@tanstack/db';
|
|
6
6
|
import { useOptionalDbClient } from './db-context.js';
|
|
7
7
|
/** Copy a snapshot's ordered rows; a single-result query's `data` is one row. */
|
|
8
8
|
function snapshotRows(data) {
|
|
@@ -106,12 +106,7 @@ export function useLiveQuery(configOrQueryOrCollection, deps = []) {
|
|
|
106
106
|
collection,
|
|
107
107
|
client: dbClient,
|
|
108
108
|
queryHash,
|
|
109
|
-
resumeDeferredCollections: () =>
|
|
110
|
-
for (const deferredCollection of deferredCollections) {
|
|
111
|
-
deferredCollection._resumeSyncStart();
|
|
112
|
-
}
|
|
113
|
-
deferredCollections.clear();
|
|
114
|
-
},
|
|
109
|
+
resumeDeferredCollections: () => resumeDeferredLiveQueryCollections(deferredCollections),
|
|
115
110
|
};
|
|
116
111
|
});
|
|
117
112
|
let currentResolved = untrack(() => resolved);
|
|
@@ -174,8 +169,15 @@ export function useLiveQuery(configOrQueryOrCollection, deps = []) {
|
|
|
174
169
|
const unsubscribe = observer.subscribe((changes) => {
|
|
175
170
|
syncFromObserver(observer, changes);
|
|
176
171
|
});
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
try {
|
|
173
|
+
currentResolved.resumeDeferredCollections();
|
|
174
|
+
syncFromObserver(observer);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
unsubscribe();
|
|
178
|
+
observer.dispose();
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
179
181
|
// Cleanup when effect is invalidated
|
|
180
182
|
return () => {
|
|
181
183
|
unsubscribe();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-db",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Svelte integration for @tanstack/db",
|
|
5
5
|
"author": "Kyle Mathews",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"skills"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tanstack/db": "0.
|
|
38
|
+
"@tanstack/db": "0.14.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"svelte": "^5.0.0"
|