@tanstack/solid-query-persist-client 5.90.26 → 6.0.0-alpha.0
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/build/dev.cjs +992 -7
- package/build/dev.js +993 -8
- package/build/index.cjs +992 -7
- package/build/index.js +993 -8
- package/package.json +11 -7
- package/src/PersistQueryClientProvider.tsx +29 -19
package/build/dev.cjs
CHANGED
|
@@ -1,22 +1,1006 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var queryPersistClientCore = require('@tanstack/query-persist-client-core');
|
|
4
|
-
var web = require('solid-js/web');
|
|
5
4
|
var solidJs = require('solid-js');
|
|
6
5
|
var solidQuery = require('@tanstack/solid-query');
|
|
7
6
|
|
|
8
7
|
// src/index.ts
|
|
8
|
+
|
|
9
|
+
// ../../node_modules/.pnpm/@solidjs+signals@0.12.0/node_modules/@solidjs/signals/dist/prod.js
|
|
10
|
+
var NotReadyError = class extends Error {
|
|
11
|
+
source;
|
|
12
|
+
constructor(e) {
|
|
13
|
+
super();
|
|
14
|
+
this.source = e;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var StatusError = class extends Error {
|
|
18
|
+
source;
|
|
19
|
+
constructor(e, t) {
|
|
20
|
+
super(t instanceof Error ? t.message : String(t), { cause: t });
|
|
21
|
+
this.source = e;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var REACTIVE_NONE = 0;
|
|
25
|
+
var REACTIVE_CHECK = 1 << 0;
|
|
26
|
+
var REACTIVE_DIRTY = 1 << 1;
|
|
27
|
+
var REACTIVE_RECOMPUTING_DEPS = 1 << 2;
|
|
28
|
+
var REACTIVE_IN_HEAP = 1 << 3;
|
|
29
|
+
var REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
|
|
30
|
+
var REACTIVE_ZOMBIE = 1 << 5;
|
|
31
|
+
var REACTIVE_DISPOSED = 1 << 6;
|
|
32
|
+
var REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
33
|
+
var REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
34
|
+
var STATUS_PENDING = 1 << 0;
|
|
35
|
+
var STATUS_ERROR = 1 << 1;
|
|
36
|
+
var STATUS_UNINITIALIZED = 1 << 2;
|
|
37
|
+
var EFFECT_RENDER = 1;
|
|
38
|
+
var EFFECT_USER = 2;
|
|
39
|
+
var EFFECT_TRACKED = 3;
|
|
40
|
+
var NOT_PENDING = {};
|
|
41
|
+
function actualInsertIntoHeap(e, t) {
|
|
42
|
+
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
43
|
+
if (n >= e.o) e.o = n + 1;
|
|
44
|
+
const i = e.o;
|
|
45
|
+
const r = t.l[i];
|
|
46
|
+
if (r === void 0) t.l[i] = e;
|
|
47
|
+
else {
|
|
48
|
+
const t2 = r.T;
|
|
49
|
+
t2.S = e;
|
|
50
|
+
e.T = t2;
|
|
51
|
+
r.T = e;
|
|
52
|
+
}
|
|
53
|
+
if (i > t.R) t.R = i;
|
|
54
|
+
}
|
|
55
|
+
function insertIntoHeap(e, t) {
|
|
56
|
+
let n = e.O;
|
|
57
|
+
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
58
|
+
if (n & REACTIVE_CHECK) {
|
|
59
|
+
e.O = n & -4 | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
60
|
+
} else e.O = n | REACTIVE_IN_HEAP;
|
|
61
|
+
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
62
|
+
}
|
|
63
|
+
function insertIntoHeapHeight(e, t) {
|
|
64
|
+
let n = e.O;
|
|
65
|
+
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
66
|
+
e.O = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
67
|
+
actualInsertIntoHeap(e, t);
|
|
68
|
+
}
|
|
69
|
+
function deleteFromHeap(e, t) {
|
|
70
|
+
const n = e.O;
|
|
71
|
+
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
72
|
+
e.O = n & -25;
|
|
73
|
+
const i = e.o;
|
|
74
|
+
if (e.T === e) t.l[i] = void 0;
|
|
75
|
+
else {
|
|
76
|
+
const n2 = e.S;
|
|
77
|
+
const r = t.l[i];
|
|
78
|
+
const s = n2 ?? r;
|
|
79
|
+
if (e === r) t.l[i] = n2;
|
|
80
|
+
else e.T.S = n2;
|
|
81
|
+
s.T = e.T;
|
|
82
|
+
}
|
|
83
|
+
e.T = e;
|
|
84
|
+
e.S = void 0;
|
|
85
|
+
}
|
|
86
|
+
function runHeap(e, t) {
|
|
87
|
+
e._ = false;
|
|
88
|
+
for (e.N = 0; e.N <= e.R; e.N++) {
|
|
89
|
+
let n = e.l[e.N];
|
|
90
|
+
while (n !== void 0) {
|
|
91
|
+
if (n.O & REACTIVE_IN_HEAP) t(n);
|
|
92
|
+
else adjustHeight(n, e);
|
|
93
|
+
n = e.l[e.N];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
e.R = 0;
|
|
97
|
+
}
|
|
98
|
+
function adjustHeight(e, t) {
|
|
99
|
+
deleteFromHeap(e, t);
|
|
100
|
+
let n = e.o;
|
|
101
|
+
for (let t2 = e.C; t2; t2 = t2.D) {
|
|
102
|
+
const e2 = t2.V;
|
|
103
|
+
const i = e2.m || e2;
|
|
104
|
+
if (i.L && i.o >= n) n = i.o + 1;
|
|
105
|
+
}
|
|
106
|
+
if (e.o !== n) {
|
|
107
|
+
e.o = n;
|
|
108
|
+
for (let n2 = e.I; n2 !== null; n2 = n2.p) {
|
|
109
|
+
insertIntoHeapHeight(n2.h, t);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
var transitions = /* @__PURE__ */ new Set();
|
|
114
|
+
var dirtyQueue = { l: new Array(2e3).fill(void 0), _: false, N: 0, R: 0 };
|
|
115
|
+
var zombieQueue = { l: new Array(2e3).fill(void 0), _: false, N: 0, R: 0 };
|
|
116
|
+
var clock = 0;
|
|
117
|
+
var activeTransition = null;
|
|
118
|
+
var scheduled = false;
|
|
119
|
+
var projectionWriteActive = false;
|
|
120
|
+
function runLaneEffects(e) {
|
|
121
|
+
for (const t of activeLanes) {
|
|
122
|
+
if (t.k || t.U.size > 0) continue;
|
|
123
|
+
const n = t.W[e - 1];
|
|
124
|
+
if (n.length) {
|
|
125
|
+
t.W[e - 1] = [];
|
|
126
|
+
runQueue(n, e);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function schedule() {
|
|
131
|
+
if (scheduled) return;
|
|
132
|
+
scheduled = true;
|
|
133
|
+
if (!globalQueue.H && !projectionWriteActive) queueMicrotask(flush);
|
|
134
|
+
}
|
|
135
|
+
var Queue = class {
|
|
136
|
+
i = null;
|
|
137
|
+
G = [[], []];
|
|
138
|
+
M = [];
|
|
139
|
+
created = clock;
|
|
140
|
+
addChild(e) {
|
|
141
|
+
this.M.push(e);
|
|
142
|
+
e.i = this;
|
|
143
|
+
}
|
|
144
|
+
removeChild(e) {
|
|
145
|
+
const t = this.M.indexOf(e);
|
|
146
|
+
if (t >= 0) {
|
|
147
|
+
this.M.splice(t, 1);
|
|
148
|
+
e.i = null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
notify(e, t, n, i) {
|
|
152
|
+
if (this.i) return this.i.notify(e, t, n, i);
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
run(e) {
|
|
156
|
+
if (this.G[e - 1].length) {
|
|
157
|
+
const t = this.G[e - 1];
|
|
158
|
+
this.G[e - 1] = [];
|
|
159
|
+
runQueue(t, e);
|
|
160
|
+
}
|
|
161
|
+
for (let t = 0; t < this.M.length; t++) this.M[t].run?.(e);
|
|
162
|
+
}
|
|
163
|
+
enqueue(e, t) {
|
|
164
|
+
if (e) {
|
|
165
|
+
if (currentOptimisticLane) {
|
|
166
|
+
const n = findLane(currentOptimisticLane);
|
|
167
|
+
n.W[e - 1].push(t);
|
|
168
|
+
} else {
|
|
169
|
+
this.G[e - 1].push(t);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
schedule();
|
|
173
|
+
}
|
|
174
|
+
stashQueues(e) {
|
|
175
|
+
e.G[0].push(...this.G[0]);
|
|
176
|
+
e.G[1].push(...this.G[1]);
|
|
177
|
+
this.G = [[], []];
|
|
178
|
+
for (let t = 0; t < this.M.length; t++) {
|
|
179
|
+
let n = this.M[t];
|
|
180
|
+
let i = e.M[t];
|
|
181
|
+
if (!i) {
|
|
182
|
+
i = { G: [[], []], M: [] };
|
|
183
|
+
e.M[t] = i;
|
|
184
|
+
}
|
|
185
|
+
n.stashQueues(i);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
restoreQueues(e) {
|
|
189
|
+
this.G[0].push(...e.G[0]);
|
|
190
|
+
this.G[1].push(...e.G[1]);
|
|
191
|
+
for (let t = 0; t < e.M.length; t++) {
|
|
192
|
+
const n = e.M[t];
|
|
193
|
+
let i = this.M[t];
|
|
194
|
+
if (i) i.restoreQueues(n);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
199
|
+
H = false;
|
|
200
|
+
F = [];
|
|
201
|
+
$ = [];
|
|
202
|
+
j = /* @__PURE__ */ new Set();
|
|
203
|
+
static K;
|
|
204
|
+
static Y;
|
|
205
|
+
static Z = null;
|
|
206
|
+
flush() {
|
|
207
|
+
if (this.H) return;
|
|
208
|
+
this.H = true;
|
|
209
|
+
try {
|
|
210
|
+
runHeap(dirtyQueue, _GlobalQueue.K);
|
|
211
|
+
if (activeTransition) {
|
|
212
|
+
const e = transitionComplete(activeTransition);
|
|
213
|
+
if (!e) {
|
|
214
|
+
let e2 = activeTransition;
|
|
215
|
+
runHeap(zombieQueue, _GlobalQueue.K);
|
|
216
|
+
this.F = [];
|
|
217
|
+
this.$ = [];
|
|
218
|
+
this.j = /* @__PURE__ */ new Set();
|
|
219
|
+
runLaneEffects(EFFECT_RENDER);
|
|
220
|
+
runLaneEffects(EFFECT_USER);
|
|
221
|
+
this.stashQueues(activeTransition.B);
|
|
222
|
+
clock++;
|
|
223
|
+
scheduled = dirtyQueue.R >= dirtyQueue.N;
|
|
224
|
+
reassignPendingTransition(activeTransition.F);
|
|
225
|
+
activeTransition = null;
|
|
226
|
+
finalizePureQueue(null, true);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this.F !== activeTransition.F && this.F.push(...activeTransition.F);
|
|
230
|
+
this.restoreQueues(activeTransition.B);
|
|
231
|
+
transitions.delete(activeTransition);
|
|
232
|
+
const t = activeTransition;
|
|
233
|
+
activeTransition = null;
|
|
234
|
+
reassignPendingTransition(this.F);
|
|
235
|
+
finalizePureQueue(t);
|
|
236
|
+
} else {
|
|
237
|
+
if (transitions.size) runHeap(zombieQueue, _GlobalQueue.K);
|
|
238
|
+
finalizePureQueue();
|
|
239
|
+
}
|
|
240
|
+
clock++;
|
|
241
|
+
scheduled = dirtyQueue.R >= dirtyQueue.N;
|
|
242
|
+
runLaneEffects(EFFECT_RENDER);
|
|
243
|
+
this.run(EFFECT_RENDER);
|
|
244
|
+
runLaneEffects(EFFECT_USER);
|
|
245
|
+
this.run(EFFECT_USER);
|
|
246
|
+
} finally {
|
|
247
|
+
this.H = false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
notify(e, t, n, i) {
|
|
251
|
+
if (t & STATUS_PENDING) {
|
|
252
|
+
if (n & STATUS_PENDING) {
|
|
253
|
+
const t2 = i !== void 0 ? i : e.X;
|
|
254
|
+
if (activeTransition && t2 && !activeTransition.q.includes(t2.source)) {
|
|
255
|
+
activeTransition.q.push(t2.source);
|
|
256
|
+
schedule();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
initTransition(e) {
|
|
264
|
+
if (e) e = currentTransition(e);
|
|
265
|
+
if (e && e === activeTransition) return;
|
|
266
|
+
if (!e && activeTransition && activeTransition.J === clock) return;
|
|
267
|
+
if (!activeTransition) {
|
|
268
|
+
activeTransition = e ?? {
|
|
269
|
+
J: clock,
|
|
270
|
+
F: [],
|
|
271
|
+
q: [],
|
|
272
|
+
$: [],
|
|
273
|
+
j: /* @__PURE__ */ new Set(),
|
|
274
|
+
ee: [],
|
|
275
|
+
B: { G: [[], []], M: [] },
|
|
276
|
+
te: false
|
|
277
|
+
};
|
|
278
|
+
} else if (e) {
|
|
279
|
+
const t = activeTransition;
|
|
280
|
+
t.te = e;
|
|
281
|
+
e.ee.push(...t.ee);
|
|
282
|
+
for (const n of activeLanes) {
|
|
283
|
+
if (n.ne === t) n.ne = e;
|
|
284
|
+
}
|
|
285
|
+
e.$.push(...t.$);
|
|
286
|
+
for (const n of t.j) {
|
|
287
|
+
e.j.add(n);
|
|
288
|
+
}
|
|
289
|
+
transitions.delete(t);
|
|
290
|
+
activeTransition = e;
|
|
291
|
+
}
|
|
292
|
+
transitions.add(activeTransition);
|
|
293
|
+
activeTransition.J = clock;
|
|
294
|
+
for (let e2 = 0; e2 < this.F.length; e2++) {
|
|
295
|
+
const t = this.F[e2];
|
|
296
|
+
t.ne = activeTransition;
|
|
297
|
+
activeTransition.F.push(t);
|
|
298
|
+
}
|
|
299
|
+
this.F = activeTransition.F;
|
|
300
|
+
for (let e2 = 0; e2 < this.$.length; e2++) {
|
|
301
|
+
const t = this.$[e2];
|
|
302
|
+
t.ne = activeTransition;
|
|
303
|
+
activeTransition.$.push(t);
|
|
304
|
+
}
|
|
305
|
+
this.$ = activeTransition.$;
|
|
306
|
+
for (const e2 of activeLanes) {
|
|
307
|
+
if (!e2.ne) e2.ne = activeTransition;
|
|
308
|
+
}
|
|
309
|
+
for (const e2 of this.j) activeTransition.j.add(e2);
|
|
310
|
+
this.j = activeTransition.j;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
function insertSubs(e, t = false) {
|
|
314
|
+
const n = e.ie || currentOptimisticLane;
|
|
315
|
+
const i = e.re !== void 0;
|
|
316
|
+
for (let r = e.I; r !== null; r = r.p) {
|
|
317
|
+
if (i && r.h.se) {
|
|
318
|
+
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if (t && n) {
|
|
322
|
+
r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
323
|
+
assignOrMergeLane(r.h, n);
|
|
324
|
+
} else if (t) {
|
|
325
|
+
r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
326
|
+
r.h.ie = void 0;
|
|
327
|
+
}
|
|
328
|
+
const e2 = r.h;
|
|
329
|
+
if (e2.oe === EFFECT_TRACKED) {
|
|
330
|
+
if (!e2.ue) {
|
|
331
|
+
e2.ue = true;
|
|
332
|
+
e2.ce.enqueue(EFFECT_USER, e2.le);
|
|
333
|
+
}
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
337
|
+
if (s.N > r.h.o) s.N = r.h.o;
|
|
338
|
+
insertIntoHeap(r.h, s);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function finalizePureQueue(e = null, t = false) {
|
|
342
|
+
let n = !t;
|
|
343
|
+
if (!t) checkBoundaryChildren(globalQueue);
|
|
344
|
+
if (dirtyQueue.R >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.K);
|
|
345
|
+
if (n) {
|
|
346
|
+
const t2 = globalQueue.F;
|
|
347
|
+
for (let e2 = 0; e2 < t2.length; e2++) {
|
|
348
|
+
const n3 = t2[e2];
|
|
349
|
+
if (n3.ae !== NOT_PENDING) {
|
|
350
|
+
n3.fe = n3.ae;
|
|
351
|
+
n3.ae = NOT_PENDING;
|
|
352
|
+
if (n3.oe && n3.oe !== EFFECT_TRACKED) n3.ue = true;
|
|
353
|
+
}
|
|
354
|
+
if (!(n3.Ee & STATUS_PENDING)) n3.Ee &= ~STATUS_UNINITIALIZED;
|
|
355
|
+
if (n3.L) GlobalQueue.Y(n3, false, true);
|
|
356
|
+
}
|
|
357
|
+
t2.length = 0;
|
|
358
|
+
const n2 = e ? e.$ : globalQueue.$;
|
|
359
|
+
for (let e2 = 0; e2 < n2.length; e2++) {
|
|
360
|
+
const t3 = n2[e2];
|
|
361
|
+
const i2 = t3.ae;
|
|
362
|
+
t3.ie = void 0;
|
|
363
|
+
if (i2 !== NOT_PENDING && t3.fe !== i2) {
|
|
364
|
+
t3.fe = i2;
|
|
365
|
+
insertSubs(t3, true);
|
|
366
|
+
}
|
|
367
|
+
t3.ae = NOT_PENDING;
|
|
368
|
+
t3.ne = null;
|
|
369
|
+
}
|
|
370
|
+
n2.length = 0;
|
|
371
|
+
const i = e ? e.j : globalQueue.j;
|
|
372
|
+
if (GlobalQueue.Z && i.size) {
|
|
373
|
+
for (const e2 of i) {
|
|
374
|
+
GlobalQueue.Z(e2);
|
|
375
|
+
}
|
|
376
|
+
i.clear();
|
|
377
|
+
schedule();
|
|
378
|
+
}
|
|
379
|
+
for (const t3 of activeLanes) {
|
|
380
|
+
const n3 = e ? t3.ne === e : !t3.ne;
|
|
381
|
+
if (!n3) continue;
|
|
382
|
+
if (!t3.k) {
|
|
383
|
+
if (t3.W[0].length) runQueue(t3.W[0], EFFECT_RENDER);
|
|
384
|
+
if (t3.W[1].length) runQueue(t3.W[1], EFFECT_USER);
|
|
385
|
+
}
|
|
386
|
+
if (t3.Te.ie === t3) t3.Te.ie = void 0;
|
|
387
|
+
t3.U.clear();
|
|
388
|
+
t3.W[0].length = 0;
|
|
389
|
+
t3.W[1].length = 0;
|
|
390
|
+
activeLanes.delete(t3);
|
|
391
|
+
signalLanes.delete(t3.Te);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
function checkBoundaryChildren(e) {
|
|
396
|
+
for (const t of e.M) {
|
|
397
|
+
t.checkSources?.();
|
|
398
|
+
checkBoundaryChildren(t);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function reassignPendingTransition(e) {
|
|
402
|
+
for (let t = 0; t < e.length; t++) {
|
|
403
|
+
e[t].ne = activeTransition;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
var globalQueue = new GlobalQueue();
|
|
407
|
+
function flush() {
|
|
408
|
+
while (scheduled) {
|
|
409
|
+
globalQueue.flush();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function runQueue(e, t) {
|
|
413
|
+
for (let n = 0; n < e.length; n++) e[n](t);
|
|
414
|
+
}
|
|
415
|
+
function transitionComplete(e) {
|
|
416
|
+
if (e.te) return true;
|
|
417
|
+
if (e.ee.length) return false;
|
|
418
|
+
let t = true;
|
|
419
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
420
|
+
const i = e.q[n];
|
|
421
|
+
if (i.Ee & STATUS_PENDING && i.X?.source === i) {
|
|
422
|
+
t = false;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
t && (e.te = true);
|
|
427
|
+
return t;
|
|
428
|
+
}
|
|
429
|
+
function currentTransition(e) {
|
|
430
|
+
while (e.te && typeof e.te === "object") e = e.te;
|
|
431
|
+
return e;
|
|
432
|
+
}
|
|
433
|
+
function runInTransition(e, t) {
|
|
434
|
+
const n = activeTransition;
|
|
435
|
+
try {
|
|
436
|
+
activeTransition = currentTransition(e);
|
|
437
|
+
return t();
|
|
438
|
+
} finally {
|
|
439
|
+
activeTransition = n;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
var signalLanes = /* @__PURE__ */ new WeakMap();
|
|
443
|
+
var activeLanes = /* @__PURE__ */ new Set();
|
|
444
|
+
function getOrCreateLane(e) {
|
|
445
|
+
let t = signalLanes.get(e);
|
|
446
|
+
if (t) {
|
|
447
|
+
return findLane(t);
|
|
448
|
+
}
|
|
449
|
+
const n = e.de;
|
|
450
|
+
const i = n?.ie ? findLane(n.ie) : null;
|
|
451
|
+
t = { Te: e, U: /* @__PURE__ */ new Set(), W: [[], []], k: null, ne: activeTransition, Se: i };
|
|
452
|
+
signalLanes.set(e, t);
|
|
453
|
+
activeLanes.add(t);
|
|
454
|
+
e.Re = e.Oe || 0;
|
|
455
|
+
return t;
|
|
456
|
+
}
|
|
457
|
+
function findLane(e) {
|
|
458
|
+
while (e.k) e = e.k;
|
|
459
|
+
return e;
|
|
460
|
+
}
|
|
461
|
+
function mergeLanes(e, t) {
|
|
462
|
+
e = findLane(e);
|
|
463
|
+
t = findLane(t);
|
|
464
|
+
if (e === t) return e;
|
|
465
|
+
t.k = e;
|
|
466
|
+
for (const n of t.U) e.U.add(n);
|
|
467
|
+
e.W[0].push(...t.W[0]);
|
|
468
|
+
e.W[1].push(...t.W[1]);
|
|
469
|
+
return e;
|
|
470
|
+
}
|
|
471
|
+
function resolveLane(e) {
|
|
472
|
+
const t = e.ie;
|
|
473
|
+
if (!t) return void 0;
|
|
474
|
+
const n = findLane(t);
|
|
475
|
+
if (activeLanes.has(n)) return n;
|
|
476
|
+
e.ie = void 0;
|
|
477
|
+
return void 0;
|
|
478
|
+
}
|
|
479
|
+
function hasActiveOverride(e) {
|
|
480
|
+
return !!(e._e && e.ae !== NOT_PENDING);
|
|
481
|
+
}
|
|
482
|
+
function assignOrMergeLane(e, t) {
|
|
483
|
+
const n = findLane(t);
|
|
484
|
+
const i = e.ie;
|
|
485
|
+
if (i) {
|
|
486
|
+
if (i.k) {
|
|
487
|
+
e.ie = t;
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const r = findLane(i);
|
|
491
|
+
if (activeLanes.has(r)) {
|
|
492
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
493
|
+
if (n.Se && findLane(n.Se) === r) {
|
|
494
|
+
e.ie = t;
|
|
495
|
+
} else if (r.Se && findLane(r.Se) === n) ;
|
|
496
|
+
else mergeLanes(n, r);
|
|
497
|
+
}
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
e.ie = t;
|
|
502
|
+
}
|
|
503
|
+
function handleAsync(e, t, n) {
|
|
504
|
+
const i = typeof t === "object" && t !== null;
|
|
505
|
+
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
506
|
+
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
507
|
+
if (!s && !r) {
|
|
508
|
+
e.Ie = null;
|
|
509
|
+
return t;
|
|
510
|
+
}
|
|
511
|
+
e.Ie = t;
|
|
512
|
+
let o;
|
|
513
|
+
const handleError = (n2) => {
|
|
514
|
+
if (e.Ie !== t) return;
|
|
515
|
+
globalQueue.initTransition(e.ne);
|
|
516
|
+
notifyStatus(e, n2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n2);
|
|
517
|
+
e.J = clock;
|
|
518
|
+
};
|
|
519
|
+
const asyncWrite = (i2, r2) => {
|
|
520
|
+
if (e.Ie !== t) return;
|
|
521
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
522
|
+
globalQueue.initTransition(e.ne);
|
|
523
|
+
clearStatus(e);
|
|
524
|
+
const s2 = resolveLane(e);
|
|
525
|
+
if (s2) s2.U.delete(e);
|
|
526
|
+
if (e._e) {
|
|
527
|
+
const t2 = e.ae !== NOT_PENDING;
|
|
528
|
+
if (e.L) e.ae = i2;
|
|
529
|
+
if (!t2) {
|
|
530
|
+
e.fe = i2;
|
|
531
|
+
insertSubs(e);
|
|
532
|
+
}
|
|
533
|
+
e.J = clock;
|
|
534
|
+
} else if (s2) {
|
|
535
|
+
const t2 = e.fe;
|
|
536
|
+
const n2 = e.pe;
|
|
537
|
+
if (!n2 || !n2(i2, t2)) {
|
|
538
|
+
e.fe = i2;
|
|
539
|
+
e.J = clock;
|
|
540
|
+
if (e.he) {
|
|
541
|
+
setSignal(e.he, i2);
|
|
542
|
+
}
|
|
543
|
+
insertSubs(e, true);
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
setSignal(e, () => i2);
|
|
547
|
+
}
|
|
548
|
+
schedule();
|
|
549
|
+
flush();
|
|
550
|
+
r2?.();
|
|
551
|
+
};
|
|
552
|
+
if (s) {
|
|
553
|
+
let n2 = false, i2 = true;
|
|
554
|
+
t.then(
|
|
555
|
+
(e2) => {
|
|
556
|
+
if (i2) {
|
|
557
|
+
o = e2;
|
|
558
|
+
n2 = true;
|
|
559
|
+
} else asyncWrite(e2);
|
|
560
|
+
},
|
|
561
|
+
(e2) => {
|
|
562
|
+
if (!i2) handleError(e2);
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
i2 = false;
|
|
566
|
+
if (!n2) {
|
|
567
|
+
globalQueue.initTransition(e.ne);
|
|
568
|
+
throw new NotReadyError(context);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
if (r) {
|
|
572
|
+
const n2 = t[Symbol.asyncIterator]();
|
|
573
|
+
let i2 = false;
|
|
574
|
+
const iterate = () => {
|
|
575
|
+
let e2, t2 = false, r3 = true;
|
|
576
|
+
n2.next().then(
|
|
577
|
+
(n3) => {
|
|
578
|
+
if (r3) {
|
|
579
|
+
e2 = n3;
|
|
580
|
+
t2 = true;
|
|
581
|
+
} else if (!n3.done) asyncWrite(n3.value, iterate);
|
|
582
|
+
else {
|
|
583
|
+
schedule();
|
|
584
|
+
flush();
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
(e3) => {
|
|
588
|
+
if (!r3) handleError(e3);
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
r3 = false;
|
|
592
|
+
if (t2 && !e2.done) {
|
|
593
|
+
o = e2.value;
|
|
594
|
+
i2 = true;
|
|
595
|
+
return iterate();
|
|
596
|
+
}
|
|
597
|
+
return t2 && e2.done;
|
|
598
|
+
};
|
|
599
|
+
const r2 = iterate();
|
|
600
|
+
if (!i2 && !r2) {
|
|
601
|
+
globalQueue.initTransition(e.ne);
|
|
602
|
+
throw new NotReadyError(context);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return o;
|
|
606
|
+
}
|
|
607
|
+
function clearStatus(e) {
|
|
608
|
+
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
609
|
+
e.X = null;
|
|
610
|
+
updatePendingSignal(e);
|
|
611
|
+
e.Ae?.();
|
|
612
|
+
}
|
|
613
|
+
function notifyStatus(e, t, n, i, r) {
|
|
614
|
+
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
615
|
+
n = new StatusError(e, n);
|
|
616
|
+
const s = n instanceof NotReadyError && n.source === e;
|
|
617
|
+
const o = t === STATUS_PENDING && e._e && !s;
|
|
618
|
+
const u = o && hasActiveOverride(e);
|
|
619
|
+
if (!i) {
|
|
620
|
+
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
621
|
+
e.X = n;
|
|
622
|
+
updatePendingSignal(e);
|
|
623
|
+
}
|
|
624
|
+
if (r && !i) {
|
|
625
|
+
assignOrMergeLane(e, r);
|
|
626
|
+
}
|
|
627
|
+
if (u && activeTransition && n instanceof NotReadyError) {
|
|
628
|
+
const e2 = n.source;
|
|
629
|
+
if (!activeTransition.q.includes(e2)) {
|
|
630
|
+
activeTransition.q.push(e2);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const c = i || u;
|
|
634
|
+
const l = i || o ? void 0 : r;
|
|
635
|
+
if (e.Ae) {
|
|
636
|
+
if (c) {
|
|
637
|
+
e.Ae(t, n);
|
|
638
|
+
} else {
|
|
639
|
+
e.Ae();
|
|
640
|
+
}
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
for (let i2 = e.I; i2 !== null; i2 = i2.p) {
|
|
644
|
+
i2.h.J = clock;
|
|
645
|
+
if (i2.h.X !== n) {
|
|
646
|
+
!i2.h.ne && globalQueue.F.push(i2.h);
|
|
647
|
+
notifyStatus(i2.h, t, n, c, l);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
for (let i2 = e.A; i2 !== null; i2 = i2.P) {
|
|
651
|
+
for (let e2 = i2.I; e2 !== null; e2 = e2.p) {
|
|
652
|
+
e2.h.J = clock;
|
|
653
|
+
if (e2.h.X !== n) {
|
|
654
|
+
!e2.h.ne && globalQueue.F.push(e2.h);
|
|
655
|
+
notifyStatus(e2.h, t, n, c, l);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function unlinkSubs(e) {
|
|
661
|
+
const t = e.V;
|
|
662
|
+
const n = e.D;
|
|
663
|
+
const i = e.p;
|
|
664
|
+
const r = e.Pe;
|
|
665
|
+
if (i !== null) i.Pe = r;
|
|
666
|
+
else t.Ne = r;
|
|
667
|
+
if (r !== null) r.p = i;
|
|
668
|
+
else {
|
|
669
|
+
t.I = i;
|
|
670
|
+
if (i === null) {
|
|
671
|
+
t.ge?.();
|
|
672
|
+
t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return n;
|
|
676
|
+
}
|
|
677
|
+
function unobserved(e) {
|
|
678
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
679
|
+
let t = e.C;
|
|
680
|
+
while (t !== null) {
|
|
681
|
+
t = unlinkSubs(t);
|
|
682
|
+
}
|
|
683
|
+
e.C = null;
|
|
684
|
+
disposeChildren(e, true);
|
|
685
|
+
}
|
|
686
|
+
function markDisposal(e) {
|
|
687
|
+
let t = e.De;
|
|
688
|
+
while (t) {
|
|
689
|
+
t.O |= REACTIVE_ZOMBIE;
|
|
690
|
+
if (t.O & REACTIVE_IN_HEAP) {
|
|
691
|
+
deleteFromHeap(t, dirtyQueue);
|
|
692
|
+
insertIntoHeap(t, zombieQueue);
|
|
693
|
+
}
|
|
694
|
+
markDisposal(t);
|
|
695
|
+
t = t.ve;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function disposeChildren(e, t = false, n) {
|
|
699
|
+
if (e.O & REACTIVE_DISPOSED) return;
|
|
700
|
+
if (t) e.O = REACTIVE_DISPOSED;
|
|
701
|
+
let i = n ? e.be : e.De;
|
|
702
|
+
while (i) {
|
|
703
|
+
const e2 = i.ve;
|
|
704
|
+
if (i.C) {
|
|
705
|
+
const e3 = i;
|
|
706
|
+
deleteFromHeap(e3, e3.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
707
|
+
let t2 = e3.C;
|
|
708
|
+
do {
|
|
709
|
+
t2 = unlinkSubs(t2);
|
|
710
|
+
} while (t2 !== null);
|
|
711
|
+
e3.C = null;
|
|
712
|
+
e3.ye = null;
|
|
713
|
+
}
|
|
714
|
+
disposeChildren(i, true);
|
|
715
|
+
i = e2;
|
|
716
|
+
}
|
|
717
|
+
if (n) {
|
|
718
|
+
e.be = null;
|
|
719
|
+
} else {
|
|
720
|
+
e.De = null;
|
|
721
|
+
e.ve = null;
|
|
722
|
+
e.we = 0;
|
|
723
|
+
}
|
|
724
|
+
runDisposal(e, n);
|
|
725
|
+
}
|
|
726
|
+
function runDisposal(e, t) {
|
|
727
|
+
let n = t ? e.Ve : e.me;
|
|
728
|
+
if (!n) return;
|
|
729
|
+
if (Array.isArray(n)) {
|
|
730
|
+
for (let e2 = 0; e2 < n.length; e2++) {
|
|
731
|
+
const t2 = n[e2];
|
|
732
|
+
t2.call(t2);
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
n.call(n);
|
|
736
|
+
}
|
|
737
|
+
t ? e.Ve = null : e.me = null;
|
|
738
|
+
}
|
|
739
|
+
GlobalQueue.K = recompute;
|
|
740
|
+
GlobalQueue.Y = disposeChildren;
|
|
741
|
+
var tracking = false;
|
|
742
|
+
var context = null;
|
|
743
|
+
var currentOptimisticLane = null;
|
|
744
|
+
function recompute(e, t = false) {
|
|
745
|
+
const n = e.oe;
|
|
746
|
+
if (!t) {
|
|
747
|
+
if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
|
|
748
|
+
globalQueue.initTransition(e.ne);
|
|
749
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
750
|
+
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
751
|
+
else {
|
|
752
|
+
markDisposal(e);
|
|
753
|
+
e.Ve = e.me;
|
|
754
|
+
e.be = e.De;
|
|
755
|
+
e.me = null;
|
|
756
|
+
e.De = null;
|
|
757
|
+
e.we = 0;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
761
|
+
const r = hasActiveOverride(e);
|
|
762
|
+
const s = !!(e.Ee & STATUS_PENDING);
|
|
763
|
+
const o = context;
|
|
764
|
+
context = e;
|
|
765
|
+
e.ye = null;
|
|
766
|
+
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
767
|
+
e.J = clock;
|
|
768
|
+
let u = e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
769
|
+
let c = e.o;
|
|
770
|
+
let l = tracking;
|
|
771
|
+
let a = currentOptimisticLane;
|
|
772
|
+
tracking = true;
|
|
773
|
+
if (i) {
|
|
774
|
+
const t2 = resolveLane(e);
|
|
775
|
+
if (t2) currentOptimisticLane = t2;
|
|
776
|
+
}
|
|
777
|
+
try {
|
|
778
|
+
u = handleAsync(e, e.L(u));
|
|
779
|
+
clearStatus(e);
|
|
780
|
+
const t2 = resolveLane(e);
|
|
781
|
+
if (t2) {
|
|
782
|
+
t2.U.delete(e);
|
|
783
|
+
updatePendingSignal(t2.Te);
|
|
784
|
+
}
|
|
785
|
+
} catch (t2) {
|
|
786
|
+
if (t2 instanceof NotReadyError && currentOptimisticLane) {
|
|
787
|
+
const t3 = findLane(currentOptimisticLane);
|
|
788
|
+
if (t3.Te !== e) {
|
|
789
|
+
t3.U.add(e);
|
|
790
|
+
e.ie = t3;
|
|
791
|
+
updatePendingSignal(t3.Te);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
notifyStatus(
|
|
795
|
+
e,
|
|
796
|
+
t2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
797
|
+
t2,
|
|
798
|
+
void 0,
|
|
799
|
+
t2 instanceof NotReadyError ? e.ie : void 0
|
|
800
|
+
);
|
|
801
|
+
} finally {
|
|
802
|
+
tracking = l;
|
|
803
|
+
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
804
|
+
context = o;
|
|
805
|
+
}
|
|
806
|
+
if (!e.X) {
|
|
807
|
+
const o2 = e.ye;
|
|
808
|
+
let l2 = o2 !== null ? o2.D : e.C;
|
|
809
|
+
if (l2 !== null) {
|
|
810
|
+
do {
|
|
811
|
+
l2 = unlinkSubs(l2);
|
|
812
|
+
} while (l2 !== null);
|
|
813
|
+
if (o2 !== null) o2.D = null;
|
|
814
|
+
else e.C = null;
|
|
815
|
+
}
|
|
816
|
+
const a2 = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
817
|
+
const f = !e.pe || !e.pe(a2, u);
|
|
818
|
+
if (f) {
|
|
819
|
+
const o3 = r ? e.fe : void 0;
|
|
820
|
+
if (t || n && activeTransition !== e.ne || i) e.fe = u;
|
|
821
|
+
else e.ae = u;
|
|
822
|
+
if (r && !i && s) {
|
|
823
|
+
const t2 = e.Oe || 0;
|
|
824
|
+
const n2 = e.Re || 0;
|
|
825
|
+
if (t2 <= n2) e.fe = u;
|
|
826
|
+
}
|
|
827
|
+
if (!r || i || e.fe !== o3) {
|
|
828
|
+
insertSubs(e, i || r);
|
|
829
|
+
}
|
|
830
|
+
} else if (r) {
|
|
831
|
+
e.ae = u;
|
|
832
|
+
} else if (e.o != c) {
|
|
833
|
+
for (let t2 = e.I; t2 !== null; t2 = t2.p) {
|
|
834
|
+
insertIntoHeapHeight(t2.h, t2.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
currentOptimisticLane = a;
|
|
839
|
+
(!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && e._e) && globalQueue.F.push(e);
|
|
840
|
+
e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
|
|
841
|
+
}
|
|
842
|
+
function untrack(e, t) {
|
|
843
|
+
if (!tracking && true) return e();
|
|
844
|
+
const n = tracking;
|
|
845
|
+
tracking = false;
|
|
846
|
+
try {
|
|
847
|
+
return e();
|
|
848
|
+
} finally {
|
|
849
|
+
tracking = n;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function setSignal(e, t) {
|
|
853
|
+
if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
|
|
854
|
+
const n = e._e && !projectionWriteActive;
|
|
855
|
+
const i = n ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
856
|
+
if (typeof t === "function") t = t(i);
|
|
857
|
+
const r = !e.pe || !e.pe(i, t) || !!(e.Ee & STATUS_UNINITIALIZED);
|
|
858
|
+
if (!r) {
|
|
859
|
+
if (n && e.ae !== NOT_PENDING && e.L) {
|
|
860
|
+
insertSubs(e, true);
|
|
861
|
+
schedule();
|
|
862
|
+
}
|
|
863
|
+
return t;
|
|
864
|
+
}
|
|
865
|
+
if (n) {
|
|
866
|
+
const n2 = globalQueue.$.includes(e);
|
|
867
|
+
if (e.ne && n2) {
|
|
868
|
+
globalQueue.initTransition(e.ne);
|
|
869
|
+
}
|
|
870
|
+
if (e.ae === NOT_PENDING) {
|
|
871
|
+
e.ae = e.fe;
|
|
872
|
+
}
|
|
873
|
+
if (!n2) {
|
|
874
|
+
globalQueue.$.push(e);
|
|
875
|
+
}
|
|
876
|
+
e.Oe = (e.Oe || 0) + 1;
|
|
877
|
+
const i2 = getOrCreateLane(e);
|
|
878
|
+
e.ie = i2;
|
|
879
|
+
e.fe = t;
|
|
880
|
+
} else {
|
|
881
|
+
if (e.ae === NOT_PENDING) globalQueue.F.push(e);
|
|
882
|
+
e.ae = t;
|
|
883
|
+
}
|
|
884
|
+
updatePendingSignal(e);
|
|
885
|
+
if (e.he) {
|
|
886
|
+
setSignal(e.he, t);
|
|
887
|
+
}
|
|
888
|
+
e.J = clock;
|
|
889
|
+
insertSubs(e, n);
|
|
890
|
+
schedule();
|
|
891
|
+
return t;
|
|
892
|
+
}
|
|
893
|
+
function computePendingState(e) {
|
|
894
|
+
const t = e;
|
|
895
|
+
if (e._e && e.ae !== NOT_PENDING) {
|
|
896
|
+
if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
|
|
897
|
+
if (e.de) {
|
|
898
|
+
const t2 = e.ie ? findLane(e.ie) : null;
|
|
899
|
+
return !!(t2 && t2.U.size > 0);
|
|
900
|
+
}
|
|
901
|
+
return true;
|
|
902
|
+
}
|
|
903
|
+
if (e.ae !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
|
|
904
|
+
return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
|
|
905
|
+
}
|
|
906
|
+
function updatePendingSignal(e) {
|
|
907
|
+
if (e.Me) {
|
|
908
|
+
const t = computePendingState(e);
|
|
909
|
+
const n = e.Me;
|
|
910
|
+
setSignal(n, t);
|
|
911
|
+
if (!t && n.ie) {
|
|
912
|
+
const t2 = resolveLane(e);
|
|
913
|
+
if (t2 && t2.U.size > 0) {
|
|
914
|
+
const e2 = findLane(n.ie);
|
|
915
|
+
if (e2 !== t2) {
|
|
916
|
+
mergeLanes(t2, e2);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
signalLanes.delete(n);
|
|
920
|
+
n.ie = void 0;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
function isWrappable(e) {
|
|
925
|
+
return e != null && typeof e === "object" && !Object.isFrozen(e);
|
|
926
|
+
}
|
|
927
|
+
var DELETE = /* @__PURE__ */ Symbol(0);
|
|
928
|
+
function updatePath(e, t, n = 0) {
|
|
929
|
+
let i, r = e;
|
|
930
|
+
if (n < t.length - 1) {
|
|
931
|
+
i = t[n];
|
|
932
|
+
const s2 = typeof i;
|
|
933
|
+
const o = Array.isArray(e);
|
|
934
|
+
if (Array.isArray(i)) {
|
|
935
|
+
for (let r2 = 0; r2 < i.length; r2++) {
|
|
936
|
+
t[n] = i[r2];
|
|
937
|
+
updatePath(e, t, n);
|
|
938
|
+
}
|
|
939
|
+
t[n] = i;
|
|
940
|
+
return;
|
|
941
|
+
} else if (o && s2 === "function") {
|
|
942
|
+
for (let r2 = 0; r2 < e.length; r2++) {
|
|
943
|
+
if (i(e[r2], r2)) {
|
|
944
|
+
t[n] = r2;
|
|
945
|
+
updatePath(e, t, n);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
t[n] = i;
|
|
949
|
+
return;
|
|
950
|
+
} else if (o && s2 === "object") {
|
|
951
|
+
const { from: r2 = 0, to: s3 = e.length - 1, by: o2 = 1 } = i;
|
|
952
|
+
for (let i2 = r2; i2 <= s3; i2 += o2) {
|
|
953
|
+
t[n] = i2;
|
|
954
|
+
updatePath(e, t, n);
|
|
955
|
+
}
|
|
956
|
+
t[n] = i;
|
|
957
|
+
return;
|
|
958
|
+
} else if (n < t.length - 2) {
|
|
959
|
+
updatePath(e[i], t, n + 1);
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
r = e[i];
|
|
963
|
+
}
|
|
964
|
+
let s = t[t.length - 1];
|
|
965
|
+
if (typeof s === "function") {
|
|
966
|
+
s = s(r);
|
|
967
|
+
if (s === r) return;
|
|
968
|
+
}
|
|
969
|
+
if (i === void 0 && s == void 0) return;
|
|
970
|
+
if (s === DELETE) {
|
|
971
|
+
delete e[i];
|
|
972
|
+
} else if (i === void 0 || isWrappable(r) && isWrappable(s) && !Array.isArray(s)) {
|
|
973
|
+
const t2 = i !== void 0 ? e[i] : e;
|
|
974
|
+
const n2 = Object.keys(s);
|
|
975
|
+
for (let e2 = 0; e2 < n2.length; e2++) t2[n2[e2]] = s[n2[e2]];
|
|
976
|
+
} else {
|
|
977
|
+
e[i] = s;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
Object.assign(
|
|
981
|
+
function storePath2(...e) {
|
|
982
|
+
return (t) => {
|
|
983
|
+
updatePath(t, e);
|
|
984
|
+
};
|
|
985
|
+
},
|
|
986
|
+
{ DELETE }
|
|
987
|
+
);
|
|
9
988
|
exports.PersistQueryClientProvider = (props) => {
|
|
10
989
|
const [isRestoring, setIsRestoring] = solidJs.createSignal(true);
|
|
990
|
+
let didRestore = false;
|
|
11
991
|
const options = solidJs.createMemo(() => ({
|
|
12
992
|
...props.persistOptions,
|
|
13
993
|
queryClient: props.client
|
|
14
994
|
}));
|
|
15
995
|
solidJs.createEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
996
|
+
const opts = options();
|
|
997
|
+
if (!didRestore) {
|
|
998
|
+
didRestore = true;
|
|
999
|
+
queryPersistClientCore.persistQueryClientRestore(opts).then(() => props.onSuccess?.()).catch(() => props.onError?.()).finally(() => {
|
|
1000
|
+
setIsRestoring(false);
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
}, () => {
|
|
20
1004
|
});
|
|
21
1005
|
solidJs.createEffect(() => {
|
|
22
1006
|
let unsubscribe = () => {
|
|
@@ -25,13 +1009,14 @@ exports.PersistQueryClientProvider = (props) => {
|
|
|
25
1009
|
unsubscribe = queryPersistClientCore.persistQueryClientSubscribe(options());
|
|
26
1010
|
}
|
|
27
1011
|
solidJs.onCleanup(() => unsubscribe());
|
|
1012
|
+
}, () => {
|
|
28
1013
|
});
|
|
29
|
-
return
|
|
1014
|
+
return solidJs.createComponent(solidQuery.QueryClientProvider, {
|
|
30
1015
|
get client() {
|
|
31
1016
|
return props.client;
|
|
32
1017
|
},
|
|
33
1018
|
get children() {
|
|
34
|
-
return
|
|
1019
|
+
return solidJs.createComponent(solidQuery.IsRestoringContext, {
|
|
35
1020
|
value: isRestoring,
|
|
36
1021
|
get children() {
|
|
37
1022
|
return props.children;
|