@gaddario98/react-core 2.0.5 → 2.0.7
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/auth/index.d.ts +4 -4
- package/dist/auth/index.js +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/auth/index.mjs.map +1 -1
- package/dist/form/index.js +155 -143
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +153 -141
- package/dist/form/index.mjs.map +1 -1
- package/dist/index.d.ts +43 -41
- package/dist/index.js +770 -1548
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +761 -1539
- package/dist/index.mjs.map +1 -1
- package/dist/pages/index.d.ts +31 -32
- package/dist/pages/index.js +148 -143
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/index.mjs +148 -143
- package/dist/pages/index.mjs.map +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +371 -314
- package/dist/queries/index.js.map +1 -1
- package/dist/queries/index.mjs +371 -314
- package/dist/queries/index.mjs.map +1 -1
- package/dist/state/index.js +183 -151
- package/dist/state/index.js.map +1 -1
- package/dist/state/index.mjs +183 -151
- package/dist/state/index.mjs.map +1 -1
- package/dist/utiles/index.js +230 -151
- package/dist/utiles/index.js.map +1 -1
- package/dist/utiles/index.mjs +230 -151
- package/dist/utiles/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/queries/index.js
CHANGED
|
@@ -61,29 +61,22 @@ function getMountedOrPendingDependents(atom, atomState, mountedMap) {
|
|
|
61
61
|
}
|
|
62
62
|
return dependents;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
if (atom.unstable_onInit) {
|
|
71
|
-
console.warn(
|
|
72
|
-
"[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."
|
|
73
|
-
);
|
|
74
|
-
return atom.unstable_onInit(store);
|
|
75
|
-
}
|
|
64
|
+
const BUILDING_BLOCK_atomRead = (_store, atom, ...params) => atom.read(...params);
|
|
65
|
+
const BUILDING_BLOCK_atomWrite = (_store, atom, ...params) => atom.write(...params);
|
|
66
|
+
const BUILDING_BLOCK_atomOnInit = (store, atom) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = atom.INTERNAL_onInit) == null ? void 0 : _a.call(atom, store);
|
|
76
69
|
};
|
|
77
|
-
const
|
|
70
|
+
const BUILDING_BLOCK_atomOnMount = (_store, atom, setAtom) => {
|
|
78
71
|
var _a;
|
|
79
72
|
return (_a = atom.onMount) == null ? void 0 : _a.call(atom, setAtom);
|
|
80
73
|
};
|
|
81
|
-
const
|
|
74
|
+
const BUILDING_BLOCK_ensureAtomState = (store, atom) => {
|
|
82
75
|
var _a;
|
|
83
76
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
84
77
|
const atomStateMap = buildingBlocks[0];
|
|
85
78
|
const storeHooks = buildingBlocks[6];
|
|
86
|
-
const
|
|
79
|
+
const atomOnInit = buildingBlocks[9];
|
|
87
80
|
if ((undefined ? undefined.MODE : void 0) !== "production" && !atom) {
|
|
88
81
|
throw new Error("Atom is undefined or null");
|
|
89
82
|
}
|
|
@@ -92,18 +85,18 @@ const ensureAtomState = (store, atom) => {
|
|
|
92
85
|
atomState = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 };
|
|
93
86
|
atomStateMap.set(atom, atomState);
|
|
94
87
|
(_a = storeHooks.i) == null ? void 0 : _a.call(storeHooks, atom);
|
|
95
|
-
|
|
88
|
+
atomOnInit == null ? void 0 : atomOnInit(store, atom);
|
|
96
89
|
}
|
|
97
90
|
return atomState;
|
|
98
91
|
};
|
|
99
|
-
const
|
|
92
|
+
const BUILDING_BLOCK_flushCallbacks = (store) => {
|
|
100
93
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
101
94
|
const mountedMap = buildingBlocks[1];
|
|
102
95
|
const changedAtoms = buildingBlocks[3];
|
|
103
96
|
const mountCallbacks = buildingBlocks[4];
|
|
104
97
|
const unmountCallbacks = buildingBlocks[5];
|
|
105
98
|
const storeHooks = buildingBlocks[6];
|
|
106
|
-
const
|
|
99
|
+
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
107
100
|
const errors = [];
|
|
108
101
|
const call = (fn) => {
|
|
109
102
|
try {
|
|
@@ -129,28 +122,28 @@ const flushCallbacks = (store) => {
|
|
|
129
122
|
mountCallbacks.clear();
|
|
130
123
|
callbacks.forEach(call);
|
|
131
124
|
if (changedAtoms.size) {
|
|
132
|
-
|
|
125
|
+
recomputeInvalidatedAtoms(store);
|
|
133
126
|
}
|
|
134
127
|
} while (changedAtoms.size || unmountCallbacks.size || mountCallbacks.size);
|
|
135
128
|
if (errors.length) {
|
|
136
129
|
throw new AggregateError(errors);
|
|
137
130
|
}
|
|
138
131
|
};
|
|
139
|
-
const
|
|
132
|
+
const BUILDING_BLOCK_recomputeInvalidatedAtoms = (store) => {
|
|
140
133
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
141
134
|
const mountedMap = buildingBlocks[1];
|
|
142
135
|
const invalidatedAtoms = buildingBlocks[2];
|
|
143
136
|
const changedAtoms = buildingBlocks[3];
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
137
|
+
const ensureAtomState = buildingBlocks[11];
|
|
138
|
+
const readAtomState = buildingBlocks[14];
|
|
139
|
+
const mountDependencies = buildingBlocks[17];
|
|
147
140
|
const topSortedReversed = [];
|
|
148
141
|
const visiting = /* @__PURE__ */ new WeakSet();
|
|
149
142
|
const visited = /* @__PURE__ */ new WeakSet();
|
|
150
143
|
const stack = Array.from(changedAtoms);
|
|
151
144
|
while (stack.length) {
|
|
152
145
|
const a = stack[stack.length - 1];
|
|
153
|
-
const aState =
|
|
146
|
+
const aState = ensureAtomState(store, a);
|
|
154
147
|
if (visited.has(a)) {
|
|
155
148
|
stack.pop();
|
|
156
149
|
continue;
|
|
@@ -182,35 +175,36 @@ const recomputeInvalidatedAtoms = (store) => {
|
|
|
182
175
|
}
|
|
183
176
|
}
|
|
184
177
|
if (hasChangedDeps) {
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
readAtomState(store, a);
|
|
179
|
+
mountDependencies(store, a);
|
|
187
180
|
}
|
|
188
181
|
invalidatedAtoms.delete(a);
|
|
189
182
|
}
|
|
190
183
|
};
|
|
191
184
|
const storeMutationSet = /* @__PURE__ */ new WeakSet();
|
|
192
|
-
const
|
|
185
|
+
const BUILDING_BLOCK_readAtomState = (store, atom) => {
|
|
193
186
|
var _a, _b;
|
|
194
187
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
195
188
|
const mountedMap = buildingBlocks[1];
|
|
196
189
|
const invalidatedAtoms = buildingBlocks[2];
|
|
197
190
|
const changedAtoms = buildingBlocks[3];
|
|
198
191
|
const storeHooks = buildingBlocks[6];
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
192
|
+
const atomRead = buildingBlocks[7];
|
|
193
|
+
const ensureAtomState = buildingBlocks[11];
|
|
194
|
+
const flushCallbacks = buildingBlocks[12];
|
|
195
|
+
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
196
|
+
const readAtomState = buildingBlocks[14];
|
|
197
|
+
const writeAtomState = buildingBlocks[16];
|
|
198
|
+
const mountDependencies = buildingBlocks[17];
|
|
199
|
+
const setAtomStateValueOrPromise = buildingBlocks[20];
|
|
200
|
+
const atomState = ensureAtomState(store, atom);
|
|
207
201
|
if (isAtomStateInitialized(atomState)) {
|
|
208
202
|
if (mountedMap.has(atom) && invalidatedAtoms.get(atom) !== atomState.n) {
|
|
209
203
|
return atomState;
|
|
210
204
|
}
|
|
211
205
|
let hasChangedDeps = false;
|
|
212
206
|
for (const [a, n] of atomState.d) {
|
|
213
|
-
if (
|
|
207
|
+
if (readAtomState(store, a).n !== n) {
|
|
214
208
|
hasChangedDeps = true;
|
|
215
209
|
break;
|
|
216
210
|
}
|
|
@@ -223,15 +217,15 @@ const readAtomState = (store, atom) => {
|
|
|
223
217
|
let isSync = true;
|
|
224
218
|
function mountDependenciesIfAsync() {
|
|
225
219
|
if (mountedMap.has(atom)) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
220
|
+
mountDependencies(store, atom);
|
|
221
|
+
recomputeInvalidatedAtoms(store);
|
|
222
|
+
flushCallbacks(store);
|
|
229
223
|
}
|
|
230
224
|
}
|
|
231
225
|
function getter(a) {
|
|
232
226
|
var _a2;
|
|
233
227
|
if (a === atom) {
|
|
234
|
-
const aState2 =
|
|
228
|
+
const aState2 = ensureAtomState(store, a);
|
|
235
229
|
if (!isAtomStateInitialized(aState2)) {
|
|
236
230
|
if (hasInitialValue(a)) {
|
|
237
231
|
setAtomStateValueOrPromise(store, a, a.init);
|
|
@@ -241,7 +235,7 @@ const readAtomState = (store, atom) => {
|
|
|
241
235
|
}
|
|
242
236
|
return returnAtomValue(aState2);
|
|
243
237
|
}
|
|
244
|
-
const aState =
|
|
238
|
+
const aState = readAtomState(store, a);
|
|
245
239
|
try {
|
|
246
240
|
return returnAtomValue(aState);
|
|
247
241
|
} finally {
|
|
@@ -267,6 +261,11 @@ const readAtomState = (store, atom) => {
|
|
|
267
261
|
return controller.signal;
|
|
268
262
|
},
|
|
269
263
|
get setSelf() {
|
|
264
|
+
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
265
|
+
console.warn(
|
|
266
|
+
"[DEPRECATED] setSelf is deprecated and will be removed in v3."
|
|
267
|
+
);
|
|
268
|
+
}
|
|
270
269
|
if ((undefined ? undefined.MODE : void 0) !== "production" && !isActuallyWritableAtom(atom)) {
|
|
271
270
|
console.warn("setSelf function cannot be used with read-only atom");
|
|
272
271
|
}
|
|
@@ -277,10 +276,10 @@ const readAtomState = (store, atom) => {
|
|
|
277
276
|
}
|
|
278
277
|
if (!isSync) {
|
|
279
278
|
try {
|
|
280
|
-
return
|
|
279
|
+
return writeAtomState(store, atom, ...args);
|
|
281
280
|
} finally {
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
recomputeInvalidatedAtoms(store);
|
|
282
|
+
flushCallbacks(store);
|
|
284
283
|
}
|
|
285
284
|
}
|
|
286
285
|
};
|
|
@@ -293,7 +292,7 @@ const readAtomState = (store, atom) => {
|
|
|
293
292
|
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
294
293
|
storeMutationSet.delete(store);
|
|
295
294
|
}
|
|
296
|
-
const valueOrPromise =
|
|
295
|
+
const valueOrPromise = atomRead(store, atom, getter, options);
|
|
297
296
|
if ((undefined ? undefined.MODE : void 0) !== "production" && storeMutationSet.has(store)) {
|
|
298
297
|
console.warn(
|
|
299
298
|
"Detected store mutation during atom read. This is not supported."
|
|
@@ -320,38 +319,40 @@ const readAtomState = (store, atom) => {
|
|
|
320
319
|
}
|
|
321
320
|
}
|
|
322
321
|
};
|
|
323
|
-
const
|
|
322
|
+
const BUILDING_BLOCK_invalidateDependents = (store, atom) => {
|
|
324
323
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
325
324
|
const mountedMap = buildingBlocks[1];
|
|
326
325
|
const invalidatedAtoms = buildingBlocks[2];
|
|
327
|
-
const
|
|
326
|
+
const ensureAtomState = buildingBlocks[11];
|
|
328
327
|
const stack = [atom];
|
|
329
328
|
while (stack.length) {
|
|
330
329
|
const a = stack.pop();
|
|
331
|
-
const aState =
|
|
330
|
+
const aState = ensureAtomState(store, a);
|
|
332
331
|
for (const d of getMountedOrPendingDependents(a, aState, mountedMap)) {
|
|
333
|
-
const dState =
|
|
332
|
+
const dState = ensureAtomState(store, d);
|
|
334
333
|
invalidatedAtoms.set(d, dState.n);
|
|
335
334
|
stack.push(d);
|
|
336
335
|
}
|
|
337
336
|
}
|
|
338
337
|
};
|
|
339
|
-
const
|
|
338
|
+
const BUILDING_BLOCK_writeAtomState = (store, atom, ...args) => {
|
|
340
339
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
341
340
|
const changedAtoms = buildingBlocks[3];
|
|
342
341
|
const storeHooks = buildingBlocks[6];
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
const
|
|
342
|
+
const atomWrite = buildingBlocks[8];
|
|
343
|
+
const ensureAtomState = buildingBlocks[11];
|
|
344
|
+
const flushCallbacks = buildingBlocks[12];
|
|
345
|
+
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
346
|
+
const readAtomState = buildingBlocks[14];
|
|
347
|
+
const invalidateDependents = buildingBlocks[15];
|
|
348
|
+
const writeAtomState = buildingBlocks[16];
|
|
349
|
+
const mountDependencies = buildingBlocks[17];
|
|
350
|
+
const setAtomStateValueOrPromise = buildingBlocks[20];
|
|
350
351
|
let isSync = true;
|
|
351
|
-
const getter = (a) => returnAtomValue(
|
|
352
|
+
const getter = (a) => returnAtomValue(readAtomState(store, a));
|
|
352
353
|
const setter = (a, ...args2) => {
|
|
353
354
|
var _a;
|
|
354
|
-
const aState =
|
|
355
|
+
const aState = ensureAtomState(store, a);
|
|
355
356
|
try {
|
|
356
357
|
if (a === atom) {
|
|
357
358
|
if (!hasInitialValue(a)) {
|
|
@@ -363,10 +364,10 @@ const writeAtomState = (store, atom, ...args) => {
|
|
|
363
364
|
const prevEpochNumber = aState.n;
|
|
364
365
|
const v = args2[0];
|
|
365
366
|
setAtomStateValueOrPromise(store, a, v);
|
|
366
|
-
|
|
367
|
+
mountDependencies(store, a);
|
|
367
368
|
if (prevEpochNumber !== aState.n) {
|
|
368
369
|
changedAtoms.add(a);
|
|
369
|
-
|
|
370
|
+
invalidateDependents(store, a);
|
|
370
371
|
(_a = storeHooks.c) == null ? void 0 : _a.call(storeHooks, a);
|
|
371
372
|
}
|
|
372
373
|
return void 0;
|
|
@@ -375,39 +376,39 @@ const writeAtomState = (store, atom, ...args) => {
|
|
|
375
376
|
}
|
|
376
377
|
} finally {
|
|
377
378
|
if (!isSync) {
|
|
378
|
-
|
|
379
|
-
|
|
379
|
+
recomputeInvalidatedAtoms(store);
|
|
380
|
+
flushCallbacks(store);
|
|
380
381
|
}
|
|
381
382
|
}
|
|
382
383
|
};
|
|
383
384
|
try {
|
|
384
|
-
return
|
|
385
|
+
return atomWrite(store, atom, getter, setter, ...args);
|
|
385
386
|
} finally {
|
|
386
387
|
isSync = false;
|
|
387
388
|
}
|
|
388
389
|
};
|
|
389
|
-
const
|
|
390
|
+
const BUILDING_BLOCK_mountDependencies = (store, atom) => {
|
|
390
391
|
var _a;
|
|
391
392
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
392
393
|
const mountedMap = buildingBlocks[1];
|
|
393
394
|
const changedAtoms = buildingBlocks[3];
|
|
394
395
|
const storeHooks = buildingBlocks[6];
|
|
395
|
-
const
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const atomState =
|
|
396
|
+
const ensureAtomState = buildingBlocks[11];
|
|
397
|
+
const invalidateDependents = buildingBlocks[15];
|
|
398
|
+
const mountAtom = buildingBlocks[18];
|
|
399
|
+
const unmountAtom = buildingBlocks[19];
|
|
400
|
+
const atomState = ensureAtomState(store, atom);
|
|
400
401
|
const mounted = mountedMap.get(atom);
|
|
401
402
|
if (mounted && !isPendingPromise(atomState.v)) {
|
|
402
403
|
for (const [a, n] of atomState.d) {
|
|
403
404
|
if (!mounted.d.has(a)) {
|
|
404
|
-
const aState =
|
|
405
|
-
const aMounted =
|
|
405
|
+
const aState = ensureAtomState(store, a);
|
|
406
|
+
const aMounted = mountAtom(store, a);
|
|
406
407
|
aMounted.t.add(atom);
|
|
407
408
|
mounted.d.add(a);
|
|
408
409
|
if (n !== aState.n) {
|
|
409
410
|
changedAtoms.add(a);
|
|
410
|
-
|
|
411
|
+
invalidateDependents(store, a);
|
|
411
412
|
(_a = storeHooks.c) == null ? void 0 : _a.call(storeHooks, a);
|
|
412
413
|
}
|
|
413
414
|
}
|
|
@@ -415,28 +416,29 @@ const mountDependencies = (store, atom) => {
|
|
|
415
416
|
for (const a of mounted.d) {
|
|
416
417
|
if (!atomState.d.has(a)) {
|
|
417
418
|
mounted.d.delete(a);
|
|
418
|
-
const aMounted =
|
|
419
|
+
const aMounted = unmountAtom(store, a);
|
|
419
420
|
aMounted == null ? void 0 : aMounted.t.delete(atom);
|
|
420
421
|
}
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
424
|
};
|
|
424
|
-
const
|
|
425
|
+
const BUILDING_BLOCK_mountAtom = (store, atom) => {
|
|
425
426
|
var _a;
|
|
426
427
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
427
428
|
const mountedMap = buildingBlocks[1];
|
|
428
429
|
const mountCallbacks = buildingBlocks[4];
|
|
429
430
|
const storeHooks = buildingBlocks[6];
|
|
430
|
-
const
|
|
431
|
-
const
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
const
|
|
435
|
-
const
|
|
436
|
-
const
|
|
431
|
+
const atomOnMount = buildingBlocks[10];
|
|
432
|
+
const ensureAtomState = buildingBlocks[11];
|
|
433
|
+
const flushCallbacks = buildingBlocks[12];
|
|
434
|
+
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
435
|
+
const readAtomState = buildingBlocks[14];
|
|
436
|
+
const writeAtomState = buildingBlocks[16];
|
|
437
|
+
const mountAtom = buildingBlocks[18];
|
|
438
|
+
const atomState = ensureAtomState(store, atom);
|
|
437
439
|
let mounted = mountedMap.get(atom);
|
|
438
440
|
if (!mounted) {
|
|
439
|
-
|
|
441
|
+
readAtomState(store, atom);
|
|
440
442
|
for (const a of atomState.d.keys()) {
|
|
441
443
|
const aMounted = mountAtom(store, a);
|
|
442
444
|
aMounted.t.add(atom);
|
|
@@ -452,16 +454,16 @@ const mountAtom = (store, atom) => {
|
|
|
452
454
|
let isSync = true;
|
|
453
455
|
const setAtom = (...args) => {
|
|
454
456
|
try {
|
|
455
|
-
return
|
|
457
|
+
return writeAtomState(store, atom, ...args);
|
|
456
458
|
} finally {
|
|
457
459
|
if (!isSync) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
+
recomputeInvalidatedAtoms(store);
|
|
461
|
+
flushCallbacks(store);
|
|
460
462
|
}
|
|
461
463
|
}
|
|
462
464
|
};
|
|
463
465
|
try {
|
|
464
|
-
const onUnmount =
|
|
466
|
+
const onUnmount = atomOnMount(store, atom, setAtom);
|
|
465
467
|
if (onUnmount) {
|
|
466
468
|
mounted.u = () => {
|
|
467
469
|
isSync = true;
|
|
@@ -482,15 +484,15 @@ const mountAtom = (store, atom) => {
|
|
|
482
484
|
}
|
|
483
485
|
return mounted;
|
|
484
486
|
};
|
|
485
|
-
const
|
|
487
|
+
const BUILDING_BLOCK_unmountAtom = (store, atom) => {
|
|
486
488
|
var _a, _b;
|
|
487
489
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
488
490
|
const mountedMap = buildingBlocks[1];
|
|
489
491
|
const unmountCallbacks = buildingBlocks[5];
|
|
490
492
|
const storeHooks = buildingBlocks[6];
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
const atomState =
|
|
493
|
+
const ensureAtomState = buildingBlocks[11];
|
|
494
|
+
const unmountAtom = buildingBlocks[19];
|
|
495
|
+
const atomState = ensureAtomState(store, atom);
|
|
494
496
|
let mounted = mountedMap.get(atom);
|
|
495
497
|
if (!mounted || mounted.l.size) {
|
|
496
498
|
return mounted;
|
|
@@ -509,7 +511,7 @@ const unmountAtom = (store, atom) => {
|
|
|
509
511
|
mounted = void 0;
|
|
510
512
|
mountedMap.delete(atom);
|
|
511
513
|
for (const a of atomState.d.keys()) {
|
|
512
|
-
const aMounted =
|
|
514
|
+
const aMounted = unmountAtom(store, a);
|
|
513
515
|
aMounted == null ? void 0 : aMounted.t.delete(atom);
|
|
514
516
|
}
|
|
515
517
|
(_b = storeHooks.u) == null ? void 0 : _b.call(storeHooks, atom);
|
|
@@ -517,9 +519,9 @@ const unmountAtom = (store, atom) => {
|
|
|
517
519
|
}
|
|
518
520
|
return mounted;
|
|
519
521
|
};
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
const atomState =
|
|
522
|
+
const BUILDING_BLOCK_setAtomStateValueOrPromise = (store, atom, valueOrPromise) => {
|
|
523
|
+
const ensureAtomState = getInternalBuildingBlocks(store)[11];
|
|
524
|
+
const atomState = ensureAtomState(store, atom);
|
|
523
525
|
const hasPrevValue = "v" in atomState;
|
|
524
526
|
const prevValue = atomState.v;
|
|
525
527
|
if (isPromiseLike$1(valueOrPromise)) {
|
|
@@ -527,7 +529,7 @@ const setAtomStateValueOrPromise = (store, atom, valueOrPromise) => {
|
|
|
527
529
|
addPendingPromiseToDependency(
|
|
528
530
|
atom,
|
|
529
531
|
valueOrPromise,
|
|
530
|
-
|
|
532
|
+
ensureAtomState(store, a)
|
|
531
533
|
);
|
|
532
534
|
}
|
|
533
535
|
}
|
|
@@ -540,35 +542,35 @@ const setAtomStateValueOrPromise = (store, atom, valueOrPromise) => {
|
|
|
540
542
|
}
|
|
541
543
|
}
|
|
542
544
|
};
|
|
543
|
-
const
|
|
544
|
-
const
|
|
545
|
-
return returnAtomValue(
|
|
545
|
+
const BUILDING_BLOCK_storeGet = (store, atom) => {
|
|
546
|
+
const readAtomState = getInternalBuildingBlocks(store)[14];
|
|
547
|
+
return returnAtomValue(readAtomState(store, atom));
|
|
546
548
|
};
|
|
547
|
-
const
|
|
549
|
+
const BUILDING_BLOCK_storeSet = (store, atom, ...args) => {
|
|
548
550
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
549
|
-
const
|
|
550
|
-
const
|
|
551
|
-
const
|
|
551
|
+
const flushCallbacks = buildingBlocks[12];
|
|
552
|
+
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
553
|
+
const writeAtomState = buildingBlocks[16];
|
|
552
554
|
try {
|
|
553
|
-
return
|
|
555
|
+
return writeAtomState(store, atom, ...args);
|
|
554
556
|
} finally {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
recomputeInvalidatedAtoms(store);
|
|
558
|
+
flushCallbacks(store);
|
|
557
559
|
}
|
|
558
560
|
};
|
|
559
|
-
const
|
|
561
|
+
const BUILDING_BLOCK_storeSub = (store, atom, listener) => {
|
|
560
562
|
const buildingBlocks = getInternalBuildingBlocks(store);
|
|
561
|
-
const
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
const mounted =
|
|
563
|
+
const flushCallbacks = buildingBlocks[12];
|
|
564
|
+
const mountAtom = buildingBlocks[18];
|
|
565
|
+
const unmountAtom = buildingBlocks[19];
|
|
566
|
+
const mounted = mountAtom(store, atom);
|
|
565
567
|
const listeners = mounted.l;
|
|
566
568
|
listeners.add(listener);
|
|
567
|
-
|
|
569
|
+
flushCallbacks(store);
|
|
568
570
|
return () => {
|
|
569
571
|
listeners.delete(listener);
|
|
570
|
-
|
|
571
|
-
|
|
572
|
+
unmountAtom(store, atom);
|
|
573
|
+
flushCallbacks(store);
|
|
572
574
|
};
|
|
573
575
|
};
|
|
574
576
|
const buildingBlockMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -584,16 +586,16 @@ const getInternalBuildingBlocks = (store) => {
|
|
|
584
586
|
function buildStore(...buildArgs) {
|
|
585
587
|
const store = {
|
|
586
588
|
get(atom) {
|
|
587
|
-
const
|
|
588
|
-
return
|
|
589
|
+
const storeGet = getInternalBuildingBlocks(store)[21];
|
|
590
|
+
return storeGet(store, atom);
|
|
589
591
|
},
|
|
590
592
|
set(atom, ...args) {
|
|
591
|
-
const
|
|
592
|
-
return
|
|
593
|
+
const storeSet = getInternalBuildingBlocks(store)[22];
|
|
594
|
+
return storeSet(store, atom, ...args);
|
|
593
595
|
},
|
|
594
596
|
sub(atom, listener) {
|
|
595
|
-
const
|
|
596
|
-
return
|
|
597
|
+
const storeSub = getInternalBuildingBlocks(store)[23];
|
|
598
|
+
return storeSub(store, atom, listener);
|
|
597
599
|
}
|
|
598
600
|
};
|
|
599
601
|
const buildingBlocks = [
|
|
@@ -613,24 +615,24 @@ function buildStore(...buildArgs) {
|
|
|
613
615
|
{},
|
|
614
616
|
// storeHooks
|
|
615
617
|
// atom interceptors
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
BUILDING_BLOCK_atomRead,
|
|
619
|
+
BUILDING_BLOCK_atomWrite,
|
|
620
|
+
BUILDING_BLOCK_atomOnInit,
|
|
621
|
+
BUILDING_BLOCK_atomOnMount,
|
|
620
622
|
// building-block functions
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
623
|
+
BUILDING_BLOCK_ensureAtomState,
|
|
624
|
+
BUILDING_BLOCK_flushCallbacks,
|
|
625
|
+
BUILDING_BLOCK_recomputeInvalidatedAtoms,
|
|
626
|
+
BUILDING_BLOCK_readAtomState,
|
|
627
|
+
BUILDING_BLOCK_invalidateDependents,
|
|
628
|
+
BUILDING_BLOCK_writeAtomState,
|
|
629
|
+
BUILDING_BLOCK_mountDependencies,
|
|
630
|
+
BUILDING_BLOCK_mountAtom,
|
|
631
|
+
BUILDING_BLOCK_unmountAtom,
|
|
632
|
+
BUILDING_BLOCK_setAtomStateValueOrPromise,
|
|
633
|
+
BUILDING_BLOCK_storeGet,
|
|
634
|
+
BUILDING_BLOCK_storeSet,
|
|
635
|
+
BUILDING_BLOCK_storeSub,
|
|
634
636
|
void 0
|
|
635
637
|
].map((fn, i) => buildArgs[i] || fn);
|
|
636
638
|
buildingBlockMap.set(store, Object.freeze(buildingBlocks));
|
|
@@ -856,7 +858,7 @@ function selectAtom(anAtom, selector, equalityFn = Object.is) {
|
|
|
856
858
|
);
|
|
857
859
|
}
|
|
858
860
|
|
|
859
|
-
const isPromiseLike$
|
|
861
|
+
const isPromiseLike$2 = (x) => typeof (x == null ? void 0 : x.then) === "function";
|
|
860
862
|
function createJSONStorage(getStringStorage = () => {
|
|
861
863
|
try {
|
|
862
864
|
return window.localStorage;
|
|
@@ -888,7 +890,7 @@ function createJSONStorage(getStringStorage = () => {
|
|
|
888
890
|
return lastValue;
|
|
889
891
|
};
|
|
890
892
|
const str = (_b = (_a2 = getStringStorage()) == null ? void 0 : _a2.getItem(key)) != null ? _b : null;
|
|
891
|
-
if (isPromiseLike$
|
|
893
|
+
if (isPromiseLike$2(str)) {
|
|
892
894
|
return str.then(parse);
|
|
893
895
|
}
|
|
894
896
|
return parse(str);
|
|
@@ -966,7 +968,7 @@ function atomWithStorage(key, initialValue, storage = defaultStorage, options) {
|
|
|
966
968
|
set(baseAtom, initialValue);
|
|
967
969
|
return storage.removeItem(key);
|
|
968
970
|
}
|
|
969
|
-
if (isPromiseLike$
|
|
971
|
+
if (isPromiseLike$2(nextValue)) {
|
|
970
972
|
return nextValue.then((resolvedValue) => {
|
|
971
973
|
set(baseAtom, resolvedValue);
|
|
972
974
|
return storage.setItem(key, resolvedValue);
|
|
@@ -1298,10 +1300,11 @@ function partialMatchKey(a, b) {
|
|
|
1298
1300
|
return false;
|
|
1299
1301
|
}
|
|
1300
1302
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
1301
|
-
function replaceEqualDeep(a, b) {
|
|
1303
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
1302
1304
|
if (a === b) {
|
|
1303
1305
|
return a;
|
|
1304
1306
|
}
|
|
1307
|
+
if (depth > 500) return b;
|
|
1305
1308
|
const array = isPlainArray(a) && isPlainArray(b);
|
|
1306
1309
|
if (!array && !(isPlainObject$1(a) && isPlainObject$1(b))) return b;
|
|
1307
1310
|
const aItems = array ? a : Object.keys(a);
|
|
@@ -1323,7 +1326,7 @@ function replaceEqualDeep(a, b) {
|
|
|
1323
1326
|
copy[key] = bItem;
|
|
1324
1327
|
continue;
|
|
1325
1328
|
}
|
|
1326
|
-
const v = replaceEqualDeep(aItem, bItem);
|
|
1329
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
1327
1330
|
copy[key] = v;
|
|
1328
1331
|
if (v === aItem) equalItems++;
|
|
1329
1332
|
}
|
|
@@ -1395,7 +1398,7 @@ function addToStart(items, item, max = 0) {
|
|
|
1395
1398
|
const newItems = [item, ...items];
|
|
1396
1399
|
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
1397
1400
|
}
|
|
1398
|
-
var skipToken = Symbol();
|
|
1401
|
+
var skipToken = /* @__PURE__ */Symbol();
|
|
1399
1402
|
function ensureQueryFn(options, fetchOptions) {
|
|
1400
1403
|
if (process.env.NODE_ENV !== "production") {
|
|
1401
1404
|
if (options.queryFn === skipToken) {
|
|
@@ -1415,6 +1418,29 @@ function shouldThrowError(throwOnError, params) {
|
|
|
1415
1418
|
return throwOnError(...params);
|
|
1416
1419
|
}
|
|
1417
1420
|
return !!throwOnError;
|
|
1421
|
+
}
|
|
1422
|
+
function addConsumeAwareSignal(object, getSignal, onCancelled) {
|
|
1423
|
+
let consumed = false;
|
|
1424
|
+
let signal;
|
|
1425
|
+
Object.defineProperty(object, "signal", {
|
|
1426
|
+
enumerable: true,
|
|
1427
|
+
get: () => {
|
|
1428
|
+
signal ??= getSignal();
|
|
1429
|
+
if (consumed) {
|
|
1430
|
+
return signal;
|
|
1431
|
+
}
|
|
1432
|
+
consumed = true;
|
|
1433
|
+
if (signal.aborted) {
|
|
1434
|
+
onCancelled();
|
|
1435
|
+
} else {
|
|
1436
|
+
signal.addEventListener("abort", onCancelled, {
|
|
1437
|
+
once: true
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
return signal;
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
return object;
|
|
1418
1444
|
}// src/focusManager.ts
|
|
1419
1445
|
var FocusManager = class extends Subscribable {
|
|
1420
1446
|
#focused;
|
|
@@ -1535,16 +1561,19 @@ function dehydrateMutation(mutation) {
|
|
|
1535
1561
|
};
|
|
1536
1562
|
}
|
|
1537
1563
|
function dehydrateQuery(query, serializeData, shouldRedactErrors) {
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1564
|
+
const dehydratePromise = () => {
|
|
1565
|
+
const promise = query.promise?.then(serializeData).catch(error => {
|
|
1566
|
+
if (!shouldRedactErrors(error)) {
|
|
1567
|
+
return Promise.reject(error);
|
|
1568
|
+
}
|
|
1569
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1570
|
+
console.error(`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`);
|
|
1571
|
+
}
|
|
1572
|
+
return Promise.reject(new Error("redacted"));
|
|
1573
|
+
});
|
|
1574
|
+
promise?.catch(noop$1);
|
|
1575
|
+
return promise;
|
|
1576
|
+
};
|
|
1548
1577
|
return {
|
|
1549
1578
|
dehydratedAt: Date.now(),
|
|
1550
1579
|
state: {
|
|
@@ -1556,7 +1585,7 @@ function dehydrateQuery(query, serializeData, shouldRedactErrors) {
|
|
|
1556
1585
|
queryKey: query.queryKey,
|
|
1557
1586
|
queryHash: query.queryHash,
|
|
1558
1587
|
...(query.state.status === "pending" && {
|
|
1559
|
-
promise
|
|
1588
|
+
promise: dehydratePromise()
|
|
1560
1589
|
}),
|
|
1561
1590
|
...(query.meta && {
|
|
1562
1591
|
meta: query.meta
|
|
@@ -2100,7 +2129,7 @@ var Query = class extends Removable {
|
|
|
2100
2129
|
}
|
|
2101
2130
|
async fetch(options, fetchOptions) {
|
|
2102
2131
|
if (this.state.fetchStatus !== "idle" &&
|
|
2103
|
-
// If the promise in the
|
|
2132
|
+
// If the promise in the retryer is already rejected, we have to definitely
|
|
2104
2133
|
// re-start the fetch; there is a chance that the query is still in a
|
|
2105
2134
|
// pending state when that happens
|
|
2106
2135
|
this.#retryer?.status() !== "rejected") {
|
|
@@ -2292,7 +2321,10 @@ var Query = class extends Removable {
|
|
|
2292
2321
|
fetchFailureCount: state.fetchFailureCount + 1,
|
|
2293
2322
|
fetchFailureReason: error,
|
|
2294
2323
|
fetchStatus: "idle",
|
|
2295
|
-
status: "error"
|
|
2324
|
+
status: "error",
|
|
2325
|
+
// flag existing data as invalidated if we get a background error
|
|
2326
|
+
// note that "no data" always means stale so we can set unconditionally here
|
|
2327
|
+
isInvalidated: true
|
|
2296
2328
|
};
|
|
2297
2329
|
case "invalidate":
|
|
2298
2330
|
return {
|
|
@@ -2660,10 +2692,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
2660
2692
|
};
|
|
2661
2693
|
const nextResult = result;
|
|
2662
2694
|
if (this.options.experimental_prefetchInRender) {
|
|
2695
|
+
const hasResultData = nextResult.data !== void 0;
|
|
2696
|
+
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
2663
2697
|
const finalizeThenableIfPossible = thenable => {
|
|
2664
|
-
if (
|
|
2698
|
+
if (isErrorWithoutData) {
|
|
2665
2699
|
thenable.reject(nextResult.error);
|
|
2666
|
-
} else if (
|
|
2700
|
+
} else if (hasResultData) {
|
|
2667
2701
|
thenable.resolve(nextResult.data);
|
|
2668
2702
|
}
|
|
2669
2703
|
};
|
|
@@ -2679,12 +2713,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
2679
2713
|
}
|
|
2680
2714
|
break;
|
|
2681
2715
|
case "fulfilled":
|
|
2682
|
-
if (
|
|
2716
|
+
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
2683
2717
|
recreateThenable();
|
|
2684
2718
|
}
|
|
2685
2719
|
break;
|
|
2686
2720
|
case "rejected":
|
|
2687
|
-
if (
|
|
2721
|
+
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
2688
2722
|
recreateThenable();
|
|
2689
2723
|
}
|
|
2690
2724
|
break;
|
|
@@ -2802,19 +2836,7 @@ function infiniteQueryBehavior(pages) {
|
|
|
2802
2836
|
const fetchFn = async () => {
|
|
2803
2837
|
let cancelled = false;
|
|
2804
2838
|
const addSignalProperty = object => {
|
|
2805
|
-
|
|
2806
|
-
enumerable: true,
|
|
2807
|
-
get: () => {
|
|
2808
|
-
if (context.signal.aborted) {
|
|
2809
|
-
cancelled = true;
|
|
2810
|
-
} else {
|
|
2811
|
-
context.signal.addEventListener("abort", () => {
|
|
2812
|
-
cancelled = true;
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
return context.signal;
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
2839
|
+
addConsumeAwareSignal(object, () => context.signal, () => cancelled = true);
|
|
2818
2840
|
};
|
|
2819
2841
|
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
2820
2842
|
const fetchPage = async (data, param, previous) => {
|
|
@@ -2999,7 +3021,9 @@ var Mutation = class extends Removable {
|
|
|
2999
3021
|
variables,
|
|
3000
3022
|
isPaused
|
|
3001
3023
|
});
|
|
3002
|
-
|
|
3024
|
+
if (this.#mutationCache.config.onMutate) {
|
|
3025
|
+
await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
|
|
3026
|
+
}
|
|
3003
3027
|
const context = await this.options.onMutate?.(variables, mutationFnContext);
|
|
3004
3028
|
if (context !== this.state.context) {
|
|
3005
3029
|
this.#dispatch({
|
|
@@ -3023,16 +3047,29 @@ var Mutation = class extends Removable {
|
|
|
3023
3047
|
} catch (error) {
|
|
3024
3048
|
try {
|
|
3025
3049
|
await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
|
|
3050
|
+
} catch (e) {
|
|
3051
|
+
void Promise.reject(e);
|
|
3052
|
+
}
|
|
3053
|
+
try {
|
|
3026
3054
|
await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
|
|
3055
|
+
} catch (e) {
|
|
3056
|
+
void Promise.reject(e);
|
|
3057
|
+
}
|
|
3058
|
+
try {
|
|
3027
3059
|
await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
|
|
3060
|
+
} catch (e) {
|
|
3061
|
+
void Promise.reject(e);
|
|
3062
|
+
}
|
|
3063
|
+
try {
|
|
3028
3064
|
await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
this.#dispatch({
|
|
3032
|
-
type: "error",
|
|
3033
|
-
error
|
|
3034
|
-
});
|
|
3065
|
+
} catch (e) {
|
|
3066
|
+
void Promise.reject(e);
|
|
3035
3067
|
}
|
|
3068
|
+
this.#dispatch({
|
|
3069
|
+
type: "error",
|
|
3070
|
+
error
|
|
3071
|
+
});
|
|
3072
|
+
throw error;
|
|
3036
3073
|
} finally {
|
|
3037
3074
|
this.#mutationCache.runNext(this);
|
|
3038
3075
|
}
|
|
@@ -3316,11 +3353,27 @@ var MutationObserver = class extends Subscribable {
|
|
|
3316
3353
|
mutationKey: this.options.mutationKey
|
|
3317
3354
|
};
|
|
3318
3355
|
if (action?.type === "success") {
|
|
3319
|
-
|
|
3320
|
-
|
|
3356
|
+
try {
|
|
3357
|
+
this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
|
|
3358
|
+
} catch (e) {
|
|
3359
|
+
void Promise.reject(e);
|
|
3360
|
+
}
|
|
3361
|
+
try {
|
|
3362
|
+
this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
|
|
3363
|
+
} catch (e) {
|
|
3364
|
+
void Promise.reject(e);
|
|
3365
|
+
}
|
|
3321
3366
|
} else if (action?.type === "error") {
|
|
3322
|
-
|
|
3323
|
-
|
|
3367
|
+
try {
|
|
3368
|
+
this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);
|
|
3369
|
+
} catch (e) {
|
|
3370
|
+
void Promise.reject(e);
|
|
3371
|
+
}
|
|
3372
|
+
try {
|
|
3373
|
+
this.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
|
|
3374
|
+
} catch (e) {
|
|
3375
|
+
void Promise.reject(e);
|
|
3376
|
+
}
|
|
3324
3377
|
}
|
|
3325
3378
|
}
|
|
3326
3379
|
this.listeners.forEach(listener => {
|
|
@@ -3347,6 +3400,7 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3347
3400
|
#combinedResult;
|
|
3348
3401
|
#lastCombine;
|
|
3349
3402
|
#lastResult;
|
|
3403
|
+
#lastQueryHashes;
|
|
3350
3404
|
#observerMatches = [];
|
|
3351
3405
|
constructor(client, queries, options) {
|
|
3352
3406
|
super();
|
|
@@ -3389,7 +3443,6 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3389
3443
|
notifyManager.batch(() => {
|
|
3390
3444
|
const prevObservers = this.#observers;
|
|
3391
3445
|
const newObserverMatches = this.#findMatchingObservers(this.#queries);
|
|
3392
|
-
this.#observerMatches = newObserverMatches;
|
|
3393
3446
|
newObserverMatches.forEach(match => match.observer.setOptions(match.defaultedQueryOptions));
|
|
3394
3447
|
const newObservers = newObserverMatches.map(match => match.observer);
|
|
3395
3448
|
const newResult = newObservers.map(observer => observer.getCurrentResult());
|
|
@@ -3402,6 +3455,7 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3402
3455
|
});
|
|
3403
3456
|
if (!hasStructuralChange && !hasResultChange) return;
|
|
3404
3457
|
if (hasStructuralChange) {
|
|
3458
|
+
this.#observerMatches = newObserverMatches;
|
|
3405
3459
|
this.#observers = newObservers;
|
|
3406
3460
|
}
|
|
3407
3461
|
this.#result = newResult;
|
|
@@ -3431,8 +3485,9 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3431
3485
|
getOptimisticResult(queries, combine) {
|
|
3432
3486
|
const matches = this.#findMatchingObservers(queries);
|
|
3433
3487
|
const result = matches.map(match => match.observer.getOptimisticResult(match.defaultedQueryOptions));
|
|
3488
|
+
const queryHashes = matches.map(match => match.defaultedQueryOptions.queryHash);
|
|
3434
3489
|
return [result, r => {
|
|
3435
|
-
return this.#combineResult(r ?? result, combine);
|
|
3490
|
+
return this.#combineResult(r ?? result, combine, queryHashes);
|
|
3436
3491
|
}, () => {
|
|
3437
3492
|
return this.#trackResult(result, matches);
|
|
3438
3493
|
}];
|
|
@@ -3447,11 +3502,16 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3447
3502
|
}) : observerResult;
|
|
3448
3503
|
});
|
|
3449
3504
|
}
|
|
3450
|
-
#combineResult(input, combine) {
|
|
3505
|
+
#combineResult(input, combine, queryHashes) {
|
|
3451
3506
|
if (combine) {
|
|
3452
|
-
|
|
3507
|
+
const lastHashes = this.#lastQueryHashes;
|
|
3508
|
+
const queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i]));
|
|
3509
|
+
if (!this.#combinedResult || this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) {
|
|
3453
3510
|
this.#lastCombine = combine;
|
|
3454
3511
|
this.#lastResult = this.#result;
|
|
3512
|
+
if (queryHashes !== void 0) {
|
|
3513
|
+
this.#lastQueryHashes = queryHashes;
|
|
3514
|
+
}
|
|
3455
3515
|
this.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input));
|
|
3456
3516
|
}
|
|
3457
3517
|
return this.#combinedResult;
|
|
@@ -3459,22 +3519,26 @@ var QueriesObserver = class extends Subscribable {
|
|
|
3459
3519
|
return input;
|
|
3460
3520
|
}
|
|
3461
3521
|
#findMatchingObservers(queries) {
|
|
3462
|
-
const prevObserversMap = new Map(
|
|
3522
|
+
const prevObserversMap = /* @__PURE__ */new Map();
|
|
3523
|
+
this.#observers.forEach(observer => {
|
|
3524
|
+
const key = observer.options.queryHash;
|
|
3525
|
+
if (!key) return;
|
|
3526
|
+
const previousObservers = prevObserversMap.get(key);
|
|
3527
|
+
if (previousObservers) {
|
|
3528
|
+
previousObservers.push(observer);
|
|
3529
|
+
} else {
|
|
3530
|
+
prevObserversMap.set(key, [observer]);
|
|
3531
|
+
}
|
|
3532
|
+
});
|
|
3463
3533
|
const observers = [];
|
|
3464
3534
|
queries.forEach(options => {
|
|
3465
3535
|
const defaultedOptions = this.#client.defaultQueryOptions(options);
|
|
3466
|
-
const match = prevObserversMap.get(defaultedOptions.queryHash);
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
} else {
|
|
3473
|
-
observers.push({
|
|
3474
|
-
defaultedQueryOptions: defaultedOptions,
|
|
3475
|
-
observer: new QueryObserver(this.#client, defaultedOptions)
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3536
|
+
const match = prevObserversMap.get(defaultedOptions.queryHash)?.shift();
|
|
3537
|
+
const observer = match ?? new QueryObserver(this.#client, defaultedOptions);
|
|
3538
|
+
observers.push({
|
|
3539
|
+
defaultedQueryOptions: defaultedOptions,
|
|
3540
|
+
observer
|
|
3541
|
+
});
|
|
3478
3542
|
});
|
|
3479
3543
|
return observers;
|
|
3480
3544
|
}
|
|
@@ -3919,8 +3983,9 @@ function createValue() {
|
|
|
3919
3983
|
}
|
|
3920
3984
|
var QueryErrorResetBoundaryContext = React__namespace.createContext(createValue());
|
|
3921
3985
|
var useQueryErrorResetBoundary = () => React__namespace.useContext(QueryErrorResetBoundaryContext);// src/errorBoundaryUtils.ts
|
|
3922
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
|
3923
|
-
|
|
3986
|
+
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
3987
|
+
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
3988
|
+
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
3924
3989
|
if (!errorResetBoundary.isReset()) {
|
|
3925
3990
|
options.retryOnMount = false;
|
|
3926
3991
|
}
|
|
@@ -3976,9 +4041,10 @@ function useQueries({
|
|
|
3976
4041
|
}),
|
|
3977
4042
|
[queries, client, isRestoring]
|
|
3978
4043
|
);
|
|
3979
|
-
defaultedQueries.forEach((
|
|
3980
|
-
ensureSuspenseTimers(
|
|
3981
|
-
|
|
4044
|
+
defaultedQueries.forEach((queryOptions) => {
|
|
4045
|
+
ensureSuspenseTimers(queryOptions);
|
|
4046
|
+
const query = client.getQueryCache().get(queryOptions.queryHash);
|
|
4047
|
+
ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query);
|
|
3982
4048
|
});
|
|
3983
4049
|
useClearResetErrorBoundary(errorResetBoundary);
|
|
3984
4050
|
const [observer] = React__namespace.useState(
|
|
@@ -4057,6 +4123,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
4057
4123
|
client.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
4058
4124
|
defaultedOptions
|
|
4059
4125
|
);
|
|
4126
|
+
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
4060
4127
|
if (process.env.NODE_ENV !== "production") {
|
|
4061
4128
|
if (!defaultedOptions.queryFn) {
|
|
4062
4129
|
console.error(
|
|
@@ -4066,7 +4133,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
4066
4133
|
}
|
|
4067
4134
|
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
4068
4135
|
ensureSuspenseTimers(defaultedOptions);
|
|
4069
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
|
4136
|
+
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
4070
4137
|
useClearResetErrorBoundary(errorResetBoundary);
|
|
4071
4138
|
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
4072
4139
|
const [observer] = React__namespace.useState(
|
|
@@ -4099,7 +4166,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
4099
4166
|
result,
|
|
4100
4167
|
errorResetBoundary,
|
|
4101
4168
|
throwOnError: defaultedOptions.throwOnError,
|
|
4102
|
-
query
|
|
4169
|
+
query,
|
|
4103
4170
|
suspense: defaultedOptions.suspense
|
|
4104
4171
|
})) {
|
|
4105
4172
|
throw result.error;
|
|
@@ -4114,7 +4181,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
4114
4181
|
fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
|
|
4115
4182
|
) : (
|
|
4116
4183
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
4117
|
-
|
|
4184
|
+
query?.promise
|
|
4118
4185
|
);
|
|
4119
4186
|
promise?.catch(noop$1).finally(() => {
|
|
4120
4187
|
observer.updateResult();
|
|
@@ -4409,10 +4476,11 @@ const trim = str => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uF
|
|
|
4409
4476
|
* If 'obj' is an Object callback will be called passing
|
|
4410
4477
|
* the value, key, and complete object for each property.
|
|
4411
4478
|
*
|
|
4412
|
-
* @param {Object|Array} obj The object to iterate
|
|
4479
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
4413
4480
|
* @param {Function} fn The callback to invoke for each item
|
|
4414
4481
|
*
|
|
4415
|
-
* @param {
|
|
4482
|
+
* @param {Object} [options]
|
|
4483
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
4416
4484
|
* @returns {any}
|
|
4417
4485
|
*/
|
|
4418
4486
|
function forEach(obj, fn, {
|
|
@@ -4484,7 +4552,7 @@ const isContextDefined = context => !isUndefined(context) && context !== _global
|
|
|
4484
4552
|
* Example:
|
|
4485
4553
|
*
|
|
4486
4554
|
* ```js
|
|
4487
|
-
*
|
|
4555
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
4488
4556
|
* console.log(result.foo); // outputs 456
|
|
4489
4557
|
* ```
|
|
4490
4558
|
*
|
|
@@ -4524,7 +4592,8 @@ function merge(/* obj1, obj2, obj3, ... */
|
|
|
4524
4592
|
* @param {Object} b The object to copy properties from
|
|
4525
4593
|
* @param {Object} thisArg The object to bind function to
|
|
4526
4594
|
*
|
|
4527
|
-
* @param {
|
|
4595
|
+
* @param {Object} [options]
|
|
4596
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
4528
4597
|
* @returns {Object} The resulting value of object a
|
|
4529
4598
|
*/
|
|
4530
4599
|
const extend = (a, b, thisArg, {
|
|
@@ -4532,9 +4601,19 @@ const extend = (a, b, thisArg, {
|
|
|
4532
4601
|
} = {}) => {
|
|
4533
4602
|
forEach(b, (val, key) => {
|
|
4534
4603
|
if (thisArg && isFunction$1(val)) {
|
|
4535
|
-
a
|
|
4604
|
+
Object.defineProperty(a, key, {
|
|
4605
|
+
value: bind(val, thisArg),
|
|
4606
|
+
writable: true,
|
|
4607
|
+
enumerable: true,
|
|
4608
|
+
configurable: true
|
|
4609
|
+
});
|
|
4536
4610
|
} else {
|
|
4537
|
-
a
|
|
4611
|
+
Object.defineProperty(a, key, {
|
|
4612
|
+
value: val,
|
|
4613
|
+
writable: true,
|
|
4614
|
+
enumerable: true,
|
|
4615
|
+
configurable: true
|
|
4616
|
+
});
|
|
4538
4617
|
}
|
|
4539
4618
|
}, {
|
|
4540
4619
|
allOwnKeys
|
|
@@ -4567,7 +4646,12 @@ const stripBOM = content => {
|
|
|
4567
4646
|
*/
|
|
4568
4647
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
4569
4648
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
4570
|
-
constructor.prototype
|
|
4649
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
4650
|
+
value: constructor,
|
|
4651
|
+
writable: true,
|
|
4652
|
+
enumerable: false,
|
|
4653
|
+
configurable: true
|
|
4654
|
+
});
|
|
4571
4655
|
Object.defineProperty(constructor, 'super', {
|
|
4572
4656
|
value: superConstructor.prototype
|
|
4573
4657
|
});
|
|
@@ -4894,36 +4978,39 @@ var utils$1 = {
|
|
|
4894
4978
|
setImmediate: _setImmediate,
|
|
4895
4979
|
asap,
|
|
4896
4980
|
isIterable
|
|
4897
|
-
}
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
* @param {Object} [response] The response.
|
|
4905
|
-
*
|
|
4906
|
-
* @returns {Error} The created error.
|
|
4907
|
-
*/
|
|
4908
|
-
function AxiosError(message, code, config, request, response) {
|
|
4909
|
-
Error.call(this);
|
|
4910
|
-
if (Error.captureStackTrace) {
|
|
4911
|
-
Error.captureStackTrace(this, this.constructor);
|
|
4912
|
-
} else {
|
|
4913
|
-
this.stack = new Error().stack;
|
|
4914
|
-
}
|
|
4915
|
-
this.message = message;
|
|
4916
|
-
this.name = 'AxiosError';
|
|
4917
|
-
code && (this.code = code);
|
|
4918
|
-
config && (this.config = config);
|
|
4919
|
-
request && (this.request = request);
|
|
4920
|
-
if (response) {
|
|
4921
|
-
this.response = response;
|
|
4922
|
-
this.status = response.status ? response.status : null;
|
|
4981
|
+
};class AxiosError extends Error {
|
|
4982
|
+
static from(error, code, config, request, response, customProps) {
|
|
4983
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
4984
|
+
axiosError.cause = error;
|
|
4985
|
+
axiosError.name = error.name;
|
|
4986
|
+
customProps && Object.assign(axiosError, customProps);
|
|
4987
|
+
return axiosError;
|
|
4923
4988
|
}
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4989
|
+
|
|
4990
|
+
/**
|
|
4991
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
4992
|
+
*
|
|
4993
|
+
* @param {string} message The error message.
|
|
4994
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
4995
|
+
* @param {Object} [config] The config.
|
|
4996
|
+
* @param {Object} [request] The request.
|
|
4997
|
+
* @param {Object} [response] The response.
|
|
4998
|
+
*
|
|
4999
|
+
* @returns {Error} The created error.
|
|
5000
|
+
*/
|
|
5001
|
+
constructor(message, code, config, request, response) {
|
|
5002
|
+
super(message);
|
|
5003
|
+
this.name = 'AxiosError';
|
|
5004
|
+
this.isAxiosError = true;
|
|
5005
|
+
code && (this.code = code);
|
|
5006
|
+
config && (this.config = config);
|
|
5007
|
+
request && (this.request = request);
|
|
5008
|
+
if (response) {
|
|
5009
|
+
this.response = response;
|
|
5010
|
+
this.status = response.status;
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
toJSON() {
|
|
4927
5014
|
return {
|
|
4928
5015
|
// Standard
|
|
4929
5016
|
message: this.message,
|
|
@@ -4942,46 +5029,21 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
4942
5029
|
status: this.status
|
|
4943
5030
|
};
|
|
4944
5031
|
}
|
|
4945
|
-
}
|
|
4946
|
-
const prototype$1 = AxiosError.prototype;
|
|
4947
|
-
const descriptors = {};
|
|
4948
|
-
['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL'
|
|
4949
|
-
// eslint-disable-next-line func-names
|
|
4950
|
-
].forEach(code => {
|
|
4951
|
-
descriptors[code] = {
|
|
4952
|
-
value: code
|
|
4953
|
-
};
|
|
4954
|
-
});
|
|
4955
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
4956
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {
|
|
4957
|
-
value: true
|
|
4958
|
-
});
|
|
4959
|
-
|
|
4960
|
-
// eslint-disable-next-line func-names
|
|
4961
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
4962
|
-
const axiosError = Object.create(prototype$1);
|
|
4963
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
4964
|
-
return obj !== Error.prototype;
|
|
4965
|
-
}, prop => {
|
|
4966
|
-
return prop !== 'isAxiosError';
|
|
4967
|
-
});
|
|
4968
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
4969
|
-
|
|
4970
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
4971
|
-
const errCode = code == null && error ? error.code : code;
|
|
4972
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
5032
|
+
}
|
|
4973
5033
|
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5034
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
5035
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
5036
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
5037
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
5038
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
5039
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
5040
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
5041
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
5042
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
5043
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
5044
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
5045
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
5046
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';// eslint-disable-next-line strict
|
|
4985
5047
|
var httpAdapter = null;/**
|
|
4986
5048
|
* Determines if the given thing is a array or js object.
|
|
4987
5049
|
*
|
|
@@ -5231,22 +5293,19 @@ function encode(val) {
|
|
|
5231
5293
|
* @returns {string} The formatted url
|
|
5232
5294
|
*/
|
|
5233
5295
|
function buildURL(url, params, options) {
|
|
5234
|
-
/*eslint no-param-reassign:0*/
|
|
5235
5296
|
if (!params) {
|
|
5236
5297
|
return url;
|
|
5237
5298
|
}
|
|
5238
5299
|
const _encode = options && options.encode || encode;
|
|
5239
|
-
|
|
5240
|
-
options
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
}
|
|
5244
|
-
const serializeFn = options && options.serialize;
|
|
5300
|
+
const _options = utils$1.isFunction(options) ? {
|
|
5301
|
+
serialize: options
|
|
5302
|
+
} : options;
|
|
5303
|
+
const serializeFn = _options && _options.serialize;
|
|
5245
5304
|
let serializedParams;
|
|
5246
5305
|
if (serializeFn) {
|
|
5247
|
-
serializedParams = serializeFn(params,
|
|
5306
|
+
serializedParams = serializeFn(params, _options);
|
|
5248
5307
|
} else {
|
|
5249
|
-
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params,
|
|
5308
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
5250
5309
|
}
|
|
5251
5310
|
if (serializedParams) {
|
|
5252
5311
|
const hashmarkIndex = url.indexOf("#");
|
|
@@ -5266,6 +5325,7 @@ function buildURL(url, params, options) {
|
|
|
5266
5325
|
*
|
|
5267
5326
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
5268
5327
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
5328
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
5269
5329
|
*
|
|
5270
5330
|
* @return {Number} An ID used to remove interceptor later
|
|
5271
5331
|
*/
|
|
@@ -5864,23 +5924,22 @@ function transformData(fns, response) {
|
|
|
5864
5924
|
return data;
|
|
5865
5925
|
}function isCancel(value) {
|
|
5866
5926
|
return !!(value && value.__CANCEL__);
|
|
5927
|
+
}class CanceledError extends AxiosError {
|
|
5928
|
+
/**
|
|
5929
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
5930
|
+
*
|
|
5931
|
+
* @param {string=} message The message.
|
|
5932
|
+
* @param {Object=} config The config.
|
|
5933
|
+
* @param {Object=} request The request.
|
|
5934
|
+
*
|
|
5935
|
+
* @returns {CanceledError} The created error.
|
|
5936
|
+
*/
|
|
5937
|
+
constructor(message, config, request) {
|
|
5938
|
+
super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
5939
|
+
this.name = 'CanceledError';
|
|
5940
|
+
this.__CANCEL__ = true;
|
|
5941
|
+
}
|
|
5867
5942
|
}/**
|
|
5868
|
-
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
5869
|
-
*
|
|
5870
|
-
* @param {string=} message The message.
|
|
5871
|
-
* @param {Object=} config The config.
|
|
5872
|
-
* @param {Object=} request The request.
|
|
5873
|
-
*
|
|
5874
|
-
* @returns {CanceledError} The created error.
|
|
5875
|
-
*/
|
|
5876
|
-
function CanceledError(message, config, request) {
|
|
5877
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
5878
|
-
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
5879
|
-
this.name = 'CanceledError';
|
|
5880
|
-
}
|
|
5881
|
-
utils$1.inherits(CanceledError, AxiosError, {
|
|
5882
|
-
__CANCEL__: true
|
|
5883
|
-
});/**
|
|
5884
5943
|
* Resolve or reject a Promise based on response status.
|
|
5885
5944
|
*
|
|
5886
5945
|
* @param {Function} resolve A function that resolves the promise.
|
|
@@ -6115,8 +6174,6 @@ function mergeConfig(config1, config2) {
|
|
|
6115
6174
|
}
|
|
6116
6175
|
return source;
|
|
6117
6176
|
}
|
|
6118
|
-
|
|
6119
|
-
// eslint-disable-next-line consistent-return
|
|
6120
6177
|
function mergeDeepProperties(a, b, prop, caseless) {
|
|
6121
6178
|
if (!utils$1.isUndefined(b)) {
|
|
6122
6179
|
return getMergedValue(a, b, prop, caseless);
|
|
@@ -6423,7 +6480,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
6423
6480
|
};
|
|
6424
6481
|
let timer = timeout && setTimeout(() => {
|
|
6425
6482
|
timer = null;
|
|
6426
|
-
onabort(new AxiosError(`timeout ${timeout}
|
|
6483
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
6427
6484
|
}, timeout);
|
|
6428
6485
|
const unsubscribe = () => {
|
|
6429
6486
|
if (signals) {
|
|
@@ -6888,7 +6945,7 @@ function dispatchRequest(config) {
|
|
|
6888
6945
|
}
|
|
6889
6946
|
return Promise.reject(reason);
|
|
6890
6947
|
});
|
|
6891
|
-
}const VERSION = "1.13.
|
|
6948
|
+
}const VERSION = "1.13.4";const validators$1 = {};
|
|
6892
6949
|
|
|
6893
6950
|
// eslint-disable-next-line func-names
|
|
6894
6951
|
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
@@ -7281,7 +7338,7 @@ class CancelToken {
|
|
|
7281
7338
|
*
|
|
7282
7339
|
* ```js
|
|
7283
7340
|
* function f(x, y, z) {}
|
|
7284
|
-
*
|
|
7341
|
+
* const args = [1, 2, 3];
|
|
7285
7342
|
* f.apply(null, args);
|
|
7286
7343
|
* ```
|
|
7287
7344
|
*
|