@tanstack/svelte-db 0.1.63 → 0.1.65
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 +12 -0
- package/package.json +2 -2
|
@@ -32,6 +32,18 @@ export function useLiveQuery(configOrQueryOrCollection, deps = []) {
|
|
|
32
32
|
typeof unwrappedParam.startSyncImmediate === `function` &&
|
|
33
33
|
typeof unwrappedParam.id === `string`;
|
|
34
34
|
if (isCollection) {
|
|
35
|
+
// Warn when passing a collection directly with on-demand sync mode
|
|
36
|
+
// In on-demand mode, data is only loaded when queries with predicates request it
|
|
37
|
+
// Passing the collection directly doesn't provide any predicates, so no data loads
|
|
38
|
+
const syncMode = unwrappedParam
|
|
39
|
+
.config?.syncMode;
|
|
40
|
+
if (syncMode === `on-demand`) {
|
|
41
|
+
console.warn(`[useLiveQuery] Warning: Passing a collection with syncMode "on-demand" directly to useLiveQuery ` +
|
|
42
|
+
`will not load any data. In on-demand mode, data is only loaded when queries with predicates request it.\n\n` +
|
|
43
|
+
`Instead, use a query builder function:\n` +
|
|
44
|
+
` const { data } = useLiveQuery((q) => q.from({ c: myCollection }).select(({ c }) => c))\n\n` +
|
|
45
|
+
`Or switch to syncMode "eager" if you want all data to sync automatically.`);
|
|
46
|
+
}
|
|
35
47
|
// It's already a collection, ensure sync is started for Svelte helpers
|
|
36
48
|
// Only start sync if the collection is in idle state
|
|
37
49
|
if (unwrappedParam.status === `idle`) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "Svelte integration for @tanstack/db",
|
|
5
5
|
"author": "Kyle Mathews",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"!dist/**/*.spec.*"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tanstack/db": "0.5.
|
|
36
|
+
"@tanstack/db": "0.5.22"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"svelte": "^5.0.0"
|