@party-stack/tanstack-db-patches 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +107 -2
- package/lib/cli.js +30425 -0
- package/ordered-window.md +93 -0
- package/package.json +24 -3
- package/patches/@tanstack__db@1.0.0-rc.1.4.patch +631 -0
- package/patches/@tanstack__react-db@1.0.0-rc.1.4.patch +136 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
diff --git a/dist/cjs/useLiveQuery.cjs b/dist/cjs/useLiveQuery.cjs
|
|
2
|
+
index 434dae15bc180415a97852602f4c66b754b5cdfd..cdbc59c50a36cf38291f06d55ae8335f03fcd7c4 100644
|
|
3
|
+
--- a/dist/cjs/useLiveQuery.cjs
|
|
4
|
+
+++ b/dist/cjs/useLiveQuery.cjs
|
|
5
|
+
@@ -175,7 +175,7 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`
|
|
6
|
+
commitWindow = move;
|
|
7
|
+
},
|
|
8
|
+
// Without a DbClient, Suspense starts it through a preload below.
|
|
9
|
+
- startSync: !forSuspense || dbClient !== void 0
|
|
10
|
+
+ startSync: !forSuspense
|
|
11
|
+
});
|
|
12
|
+
if (collection && !db.isCollection(preparedQueryValue)) {
|
|
13
|
+
instance.cancelReclaimRelease?.();
|
|
14
|
+
@@ -221,7 +221,7 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`
|
|
15
|
+
}
|
|
16
|
+
claim?.();
|
|
17
|
+
});
|
|
18
|
+
- if (forSuspense && !dbClient && (instance.collection?.status === `idle` || instance.collection?.status === `cleaned-up`)) {
|
|
19
|
+
+ if (forSuspense && (!dbClient || typeof window !== `undefined`) && (instance.collection?.status === `idle` || instance.collection?.status === `cleaned-up`)) {
|
|
20
|
+
observer.preload().catch(() => {
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
@@ -269,4 +269,3 @@ exports.getIdentityScope = getIdentityScope;
|
|
24
|
+
exports.prepareDerivedQuery = prepareDerivedQuery;
|
|
25
|
+
exports.useLiveQuery = useLiveQuery;
|
|
26
|
+
exports.useLiveQueryImpl = useLiveQueryImpl;
|
|
27
|
+
-//# sourceMappingURL=useLiveQuery.cjs.map
|
|
28
|
+
diff --git a/dist/cjs/useLiveSuspenseQuery.cjs b/dist/cjs/useLiveSuspenseQuery.cjs
|
|
29
|
+
index 7e1a52875fad00474a6e8aa0c34638ad37b0f1cc..d1cd2d20196853f723200ba4f4245cc361ba87b3 100644
|
|
30
|
+
--- a/dist/cjs/useLiveSuspenseQuery.cjs
|
|
31
|
+
+++ b/dist/cjs/useLiveSuspenseQuery.cjs
|
|
32
|
+
@@ -62,8 +62,7 @@ class SuspenseBinding {
|
|
33
|
+
`status:change`,
|
|
34
|
+
({ status }) => {
|
|
35
|
+
if (status === `cleaned-up`) release();
|
|
36
|
+
- else if (status === `error` || status === `crashed`)
|
|
37
|
+
- setTimeout(release, 0);
|
|
38
|
+
+
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
@@ -204,4 +203,3 @@ function useLiveSuspenseQuery(configOrQueryOrCollection) {
|
|
43
|
+
}
|
|
44
|
+
exports.SuspenseBinding = SuspenseBinding;
|
|
45
|
+
exports.useLiveSuspenseQuery = useLiveSuspenseQuery;
|
|
46
|
+
-//# sourceMappingURL=useLiveSuspenseQuery.cjs.map
|
|
47
|
+
diff --git a/dist/esm/useLiveQuery.js b/dist/esm/useLiveQuery.js
|
|
48
|
+
index 490bd344156bce378728ebafd05bee1a5fbd7388..3efc7eab263bacbba3cd0d184c44c91255bfa09b 100644
|
|
49
|
+
--- a/dist/esm/useLiveQuery.js
|
|
50
|
+
+++ b/dist/esm/useLiveQuery.js
|
|
51
|
+
@@ -174,7 +174,7 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`
|
|
52
|
+
commitWindow = move;
|
|
53
|
+
},
|
|
54
|
+
// Without a DbClient, Suspense starts it through a preload below.
|
|
55
|
+
- startSync: !forSuspense || dbClient !== void 0
|
|
56
|
+
+ startSync: !forSuspense
|
|
57
|
+
});
|
|
58
|
+
if (collection && !isCollection(preparedQueryValue)) {
|
|
59
|
+
instance.cancelReclaimRelease?.();
|
|
60
|
+
@@ -220,7 +220,7 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`
|
|
61
|
+
}
|
|
62
|
+
claim?.();
|
|
63
|
+
});
|
|
64
|
+
- if (forSuspense && !dbClient && (instance.collection?.status === `idle` || instance.collection?.status === `cleaned-up`)) {
|
|
65
|
+
+ if (forSuspense && (!dbClient || typeof window !== `undefined`) && (instance.collection?.status === `idle` || instance.collection?.status === `cleaned-up`)) {
|
|
66
|
+
observer.preload().catch(() => {
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
@@ -267,4 +267,3 @@ export {
|
|
70
|
+
useLiveQuery,
|
|
71
|
+
useLiveQueryImpl
|
|
72
|
+
};
|
|
73
|
+
-//# sourceMappingURL=useLiveQuery.js.map
|
|
74
|
+
diff --git a/dist/esm/useLiveSuspenseQuery.js b/dist/esm/useLiveSuspenseQuery.js
|
|
75
|
+
index 1eca59efe5bebf515c28ebf204227bc24475d949..3ff47e6635f4468a25d8167080cb02d33128944e 100644
|
|
76
|
+
--- a/dist/esm/useLiveSuspenseQuery.js
|
|
77
|
+
+++ b/dist/esm/useLiveSuspenseQuery.js
|
|
78
|
+
@@ -60,8 +60,7 @@ class SuspenseBinding {
|
|
79
|
+
`status:change`,
|
|
80
|
+
({ status }) => {
|
|
81
|
+
if (status === `cleaned-up`) release();
|
|
82
|
+
- else if (status === `error` || status === `crashed`)
|
|
83
|
+
- setTimeout(release, 0);
|
|
84
|
+
+
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
@@ -204,4 +203,3 @@ export {
|
|
89
|
+
SuspenseBinding,
|
|
90
|
+
useLiveSuspenseQuery
|
|
91
|
+
};
|
|
92
|
+
-//# sourceMappingURL=useLiveSuspenseQuery.js.map
|
|
93
|
+
diff --git a/src/useLiveQuery.ts b/src/useLiveQuery.ts
|
|
94
|
+
index 22a01f4eb5ebfb3f3ca3803e34a90f5d94748621..d3e3a5046e831551500e5a8069aa5de46aa0e335 100644
|
|
95
|
+
--- a/src/useLiveQuery.ts
|
|
96
|
+
+++ b/src/useLiveQuery.ts
|
|
97
|
+
@@ -691,8 +691,8 @@ export function useLiveQueryImpl(
|
|
98
|
+
onWindowChange: (move) => {
|
|
99
|
+
commitWindow = move
|
|
100
|
+
},
|
|
101
|
+
- // Without a DbClient, Suspense starts it through a preload below.
|
|
102
|
+
- startSync: !forSuspense || dbClient !== undefined,
|
|
103
|
+
+ // Suspense starts through explicit preload before its first browser snapshot.
|
|
104
|
+
+ startSync: !forSuspense,
|
|
105
|
+
})
|
|
106
|
+
// A render that never commits releases its deferred sync starts
|
|
107
|
+
// when garbage collection reclaims the live query it built. A
|
|
108
|
+
@@ -766,10 +766,10 @@ export function useLiveQueryImpl(
|
|
109
|
+
// A Suspense render asks for its data. Preloading starts the sync run, so a
|
|
110
|
+
// source that already holds the rows makes it ready before the snapshot is
|
|
111
|
+
// read instead of suspending once. useLiveSuspenseQuery surfaces failures.
|
|
112
|
+
- // A DbClient defers source starts past render and owns its streamed query.
|
|
113
|
+
+ // Server clients retain streamed admission; browser clients preload here too.
|
|
114
|
+
if (
|
|
115
|
+
forSuspense &&
|
|
116
|
+
- !dbClient &&
|
|
117
|
+
+ (!dbClient || typeof window !== `undefined`) &&
|
|
118
|
+
(instance.collection?.status === `idle` ||
|
|
119
|
+
instance.collection?.status === `cleaned-up`)
|
|
120
|
+
) {
|
|
121
|
+
diff --git a/src/useLiveSuspenseQuery.ts b/src/useLiveSuspenseQuery.ts
|
|
122
|
+
index 8aaef24f0b19a64bd233c8ff5cdc4188c14d95af..dee2e865e60b00f581e614bd0ae728c72a59e0bb 100644
|
|
123
|
+
--- a/src/useLiveSuspenseQuery.ts
|
|
124
|
+
+++ b/src/useLiveSuspenseQuery.ts
|
|
125
|
+
@@ -123,9 +123,8 @@ export class SuspenseBinding {
|
|
126
|
+
`status:change`,
|
|
127
|
+
({ status }) => {
|
|
128
|
+
if (status === `cleaned-up`) release()
|
|
129
|
+
- // Preserve failures through React's immediate retry.
|
|
130
|
+
- else if (status === `error` || status === `crashed`)
|
|
131
|
+
- setTimeout(release, 0)
|
|
132
|
+
+ // Failed initial renders must remain adoptable until collection
|
|
133
|
+
+ // cleanup too; a zero-delay release can outrun React's retry.
|
|
134
|
+
},
|
|
135
|
+
)
|
|
136
|
+
}
|