@tanstack/query-core 5.17.9 → 5.17.14
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/legacy/hydration.d.cts +1 -1
- package/build/legacy/hydration.d.ts +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +1 -1
- package/build/legacy/mutation.d.cts +1 -1
- package/build/legacy/mutation.d.ts +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationObserver.d.cts +1 -1
- package/build/legacy/mutationObserver.d.ts +1 -1
- package/build/legacy/queriesObserver.d.cts +1 -1
- package/build/legacy/queriesObserver.d.ts +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/{queryClient-bm-z2rsD.d.ts → queryClient-4ddEge6Q.d.ts} +31 -3
- package/build/legacy/{queryClient-Em4fxERQ.d.cts → queryClient-4iFPaIys.d.cts} +31 -3
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryObserver.d.cts +1 -1
- package/build/legacy/queryObserver.d.ts +1 -1
- package/build/legacy/retryer.d.cts +1 -1
- package/build/legacy/retryer.d.ts +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/utils.cjs +1 -1
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/legacy/utils.js +1 -1
- package/build/legacy/utils.js.map +1 -1
- package/build/modern/hydration.d.cts +1 -1
- package/build/modern/hydration.d.ts +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +1 -1
- package/build/modern/mutation.d.cts +1 -1
- package/build/modern/mutation.d.ts +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationObserver.d.cts +1 -1
- package/build/modern/mutationObserver.d.ts +1 -1
- package/build/modern/queriesObserver.d.cts +1 -1
- package/build/modern/queriesObserver.d.ts +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/{queryClient-bm-z2rsD.d.ts → queryClient-4ddEge6Q.d.ts} +31 -3
- package/build/modern/{queryClient-Em4fxERQ.d.cts → queryClient-4iFPaIys.d.cts} +31 -3
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryObserver.d.cts +1 -1
- package/build/modern/queryObserver.d.ts +1 -1
- package/build/modern/retryer.d.cts +1 -1
- package/build/modern/retryer.d.ts +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/utils.cjs +1 -1
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/build/modern/utils.js +1 -1
- package/build/modern/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/tests/infiniteQueryObserver.test.tsx +51 -2
- package/src/tests/queryObserver.test.tsx +38 -0
- package/src/tests/utils.test.tsx +7 -0
- package/src/types.ts +39 -1
- package/src/utils.ts +1 -1
package/src/tests/utils.test.tsx
CHANGED
|
@@ -325,6 +325,13 @@ describe('core/utils', () => {
|
|
|
325
325
|
expect(result.todos[0]?.state.done).toBe(next.todos[0]?.state.done)
|
|
326
326
|
expect(result.todos[1]).toBe(prev.todos[1])
|
|
327
327
|
})
|
|
328
|
+
|
|
329
|
+
it('should correctly handle objects with the same number of properties and one property being undefined', () => {
|
|
330
|
+
const obj1 = { a: 2, c: 123 }
|
|
331
|
+
const obj2 = { a: 2, b: undefined }
|
|
332
|
+
const result = replaceEqualDeep(obj1, obj2)
|
|
333
|
+
expect(result).toStrictEqual(obj2)
|
|
334
|
+
})
|
|
328
335
|
})
|
|
329
336
|
|
|
330
337
|
describe('matchMutation', () => {
|
package/src/types.ts
CHANGED
|
@@ -488,6 +488,20 @@ export interface QueryObserverBaseResult<
|
|
|
488
488
|
fetchStatus: FetchStatus
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
+
export interface QueryObserverPendingResult<
|
|
492
|
+
TData = unknown,
|
|
493
|
+
TError = DefaultError,
|
|
494
|
+
> extends QueryObserverBaseResult<TData, TError> {
|
|
495
|
+
data: undefined
|
|
496
|
+
error: null
|
|
497
|
+
isError: false
|
|
498
|
+
isPending: true
|
|
499
|
+
isLoadingError: false
|
|
500
|
+
isRefetchError: false
|
|
501
|
+
isSuccess: false
|
|
502
|
+
status: 'pending'
|
|
503
|
+
}
|
|
504
|
+
|
|
491
505
|
export interface QueryObserverLoadingResult<
|
|
492
506
|
TData = unknown,
|
|
493
507
|
TError = DefaultError,
|
|
@@ -496,6 +510,7 @@ export interface QueryObserverLoadingResult<
|
|
|
496
510
|
error: null
|
|
497
511
|
isError: false
|
|
498
512
|
isPending: true
|
|
513
|
+
isLoading: true
|
|
499
514
|
isLoadingError: false
|
|
500
515
|
isRefetchError: false
|
|
501
516
|
isSuccess: false
|
|
@@ -510,6 +525,7 @@ export interface QueryObserverLoadingErrorResult<
|
|
|
510
525
|
error: TError
|
|
511
526
|
isError: true
|
|
512
527
|
isPending: false
|
|
528
|
+
isLoading: false
|
|
513
529
|
isLoadingError: true
|
|
514
530
|
isRefetchError: false
|
|
515
531
|
isSuccess: false
|
|
@@ -524,6 +540,7 @@ export interface QueryObserverRefetchErrorResult<
|
|
|
524
540
|
error: TError
|
|
525
541
|
isError: true
|
|
526
542
|
isPending: false
|
|
543
|
+
isLoading: false
|
|
527
544
|
isLoadingError: false
|
|
528
545
|
isRefetchError: true
|
|
529
546
|
isSuccess: false
|
|
@@ -538,6 +555,7 @@ export interface QueryObserverSuccessResult<
|
|
|
538
555
|
error: null
|
|
539
556
|
isError: false
|
|
540
557
|
isPending: false
|
|
558
|
+
isLoading: false
|
|
541
559
|
isLoadingError: false
|
|
542
560
|
isRefetchError: false
|
|
543
561
|
isSuccess: true
|
|
@@ -555,6 +573,7 @@ export type QueryObserverResult<TData = unknown, TError = DefaultError> =
|
|
|
555
573
|
| DefinedQueryObserverResult<TData, TError>
|
|
556
574
|
| QueryObserverLoadingErrorResult<TData, TError>
|
|
557
575
|
| QueryObserverLoadingResult<TData, TError>
|
|
576
|
+
| QueryObserverPendingResult<TData, TError>
|
|
558
577
|
|
|
559
578
|
export interface InfiniteQueryObserverBaseResult<
|
|
560
579
|
TData = unknown,
|
|
@@ -572,6 +591,20 @@ export interface InfiniteQueryObserverBaseResult<
|
|
|
572
591
|
isFetchingPreviousPage: boolean
|
|
573
592
|
}
|
|
574
593
|
|
|
594
|
+
export interface InfiniteQueryObserverPendingResult<
|
|
595
|
+
TData = unknown,
|
|
596
|
+
TError = DefaultError,
|
|
597
|
+
> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
598
|
+
data: undefined
|
|
599
|
+
error: null
|
|
600
|
+
isError: false
|
|
601
|
+
isPending: true
|
|
602
|
+
isLoadingError: false
|
|
603
|
+
isRefetchError: false
|
|
604
|
+
isSuccess: false
|
|
605
|
+
status: 'pending'
|
|
606
|
+
}
|
|
607
|
+
|
|
575
608
|
export interface InfiniteQueryObserverLoadingResult<
|
|
576
609
|
TData = unknown,
|
|
577
610
|
TError = DefaultError,
|
|
@@ -580,6 +613,7 @@ export interface InfiniteQueryObserverLoadingResult<
|
|
|
580
613
|
error: null
|
|
581
614
|
isError: false
|
|
582
615
|
isPending: true
|
|
616
|
+
isLoading: true
|
|
583
617
|
isLoadingError: false
|
|
584
618
|
isRefetchError: false
|
|
585
619
|
isSuccess: false
|
|
@@ -594,6 +628,7 @@ export interface InfiniteQueryObserverLoadingErrorResult<
|
|
|
594
628
|
error: TError
|
|
595
629
|
isError: true
|
|
596
630
|
isPending: false
|
|
631
|
+
isLoading: false
|
|
597
632
|
isLoadingError: true
|
|
598
633
|
isRefetchError: false
|
|
599
634
|
isSuccess: false
|
|
@@ -608,6 +643,7 @@ export interface InfiniteQueryObserverRefetchErrorResult<
|
|
|
608
643
|
error: TError
|
|
609
644
|
isError: true
|
|
610
645
|
isPending: false
|
|
646
|
+
isLoading: false
|
|
611
647
|
isLoadingError: false
|
|
612
648
|
isRefetchError: true
|
|
613
649
|
isSuccess: false
|
|
@@ -622,6 +658,7 @@ export interface InfiniteQueryObserverSuccessResult<
|
|
|
622
658
|
error: null
|
|
623
659
|
isError: false
|
|
624
660
|
isPending: false
|
|
661
|
+
isLoading: false
|
|
625
662
|
isLoadingError: false
|
|
626
663
|
isRefetchError: false
|
|
627
664
|
isSuccess: true
|
|
@@ -639,9 +676,10 @@ export type InfiniteQueryObserverResult<
|
|
|
639
676
|
TData = unknown,
|
|
640
677
|
TError = DefaultError,
|
|
641
678
|
> =
|
|
679
|
+
| DefinedInfiniteQueryObserverResult<TData, TError>
|
|
642
680
|
| InfiniteQueryObserverLoadingErrorResult<TData, TError>
|
|
643
681
|
| InfiniteQueryObserverLoadingResult<TData, TError>
|
|
644
|
-
|
|
|
682
|
+
| InfiniteQueryObserverPendingResult<TData, TError>
|
|
645
683
|
|
|
646
684
|
export type MutationKey = ReadonlyArray<unknown>
|
|
647
685
|
|
package/src/utils.ts
CHANGED
|
@@ -234,7 +234,7 @@ export function replaceEqualDeep(a: any, b: any): any {
|
|
|
234
234
|
for (let i = 0; i < bSize; i++) {
|
|
235
235
|
const key = array ? i : bItems[i]
|
|
236
236
|
copy[key] = replaceEqualDeep(a[key], b[key])
|
|
237
|
-
if (copy[key] === a[key]) {
|
|
237
|
+
if (copy[key] === a[key] && a[key] !== undefined) {
|
|
238
238
|
equalItems++
|
|
239
239
|
}
|
|
240
240
|
}
|