@tanstack/query-core 5.0.0-alpha.81 → 5.0.0-alpha.85
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/lib/hydration.cjs +12 -4
- package/build/lib/hydration.cjs.map +1 -1
- package/build/lib/hydration.d.ts +3 -1
- package/build/lib/hydration.d.ts.map +1 -1
- package/build/lib/hydration.js +12 -4
- package/build/lib/hydration.js.map +1 -1
- package/build/lib/hydration.legacy.cjs +12 -4
- package/build/lib/hydration.legacy.cjs.map +1 -1
- package/build/lib/hydration.legacy.js +12 -4
- package/build/lib/hydration.legacy.js.map +1 -1
- package/build/lib/infiniteQueryBehavior.cjs.map +1 -1
- package/build/lib/infiniteQueryBehavior.d.ts.map +1 -1
- package/build/lib/infiniteQueryBehavior.js.map +1 -1
- package/build/lib/infiniteQueryBehavior.legacy.cjs.map +1 -1
- package/build/lib/infiniteQueryBehavior.legacy.js.map +1 -1
- package/build/lib/infiniteQueryObserver.cjs.map +1 -1
- package/build/lib/infiniteQueryObserver.d.ts +2 -2
- package/build/lib/infiniteQueryObserver.d.ts.map +1 -1
- package/build/lib/infiniteQueryObserver.js.map +1 -1
- package/build/lib/infiniteQueryObserver.legacy.cjs.map +1 -1
- package/build/lib/infiniteQueryObserver.legacy.js.map +1 -1
- package/build/lib/mutation.cjs.map +1 -1
- package/build/lib/mutation.d.ts +2 -2
- package/build/lib/mutation.d.ts.map +1 -1
- package/build/lib/mutation.js.map +1 -1
- package/build/lib/mutation.legacy.cjs.map +1 -1
- package/build/lib/mutation.legacy.js.map +1 -1
- package/build/lib/mutationCache.cjs.map +1 -1
- package/build/lib/mutationCache.d.ts +3 -3
- package/build/lib/mutationCache.d.ts.map +1 -1
- package/build/lib/mutationCache.js.map +1 -1
- package/build/lib/mutationCache.legacy.cjs.map +1 -1
- package/build/lib/mutationCache.legacy.js.map +1 -1
- package/build/lib/mutationObserver.cjs.map +1 -1
- package/build/lib/mutationObserver.d.ts +3 -3
- package/build/lib/mutationObserver.d.ts.map +1 -1
- package/build/lib/mutationObserver.js.map +1 -1
- package/build/lib/mutationObserver.legacy.cjs.map +1 -1
- package/build/lib/mutationObserver.legacy.js.map +1 -1
- package/build/lib/queriesObserver.cjs.map +1 -1
- package/build/lib/queriesObserver.d.ts +2 -2
- package/build/lib/queriesObserver.d.ts.map +1 -1
- package/build/lib/queriesObserver.js.map +1 -1
- package/build/lib/queriesObserver.legacy.cjs.map +1 -1
- package/build/lib/queriesObserver.legacy.js.map +1 -1
- package/build/lib/query.cjs.map +1 -1
- package/build/lib/query.d.ts +2 -2
- package/build/lib/query.d.ts.map +1 -1
- package/build/lib/query.js.map +1 -1
- package/build/lib/query.legacy.cjs.map +1 -1
- package/build/lib/query.legacy.js.map +1 -1
- package/build/lib/queryCache.cjs.map +1 -1
- package/build/lib/queryCache.d.ts +3 -3
- package/build/lib/queryCache.d.ts.map +1 -1
- package/build/lib/queryCache.js.map +1 -1
- package/build/lib/queryCache.legacy.cjs.map +1 -1
- package/build/lib/queryCache.legacy.js.map +1 -1
- package/build/lib/queryClient.cjs.map +1 -1
- package/build/lib/queryClient.d.ts +3 -3
- package/build/lib/queryClient.d.ts.map +1 -1
- package/build/lib/queryClient.js.map +1 -1
- package/build/lib/queryClient.legacy.cjs.map +1 -1
- package/build/lib/queryClient.legacy.js.map +1 -1
- package/build/lib/queryObserver.cjs.map +1 -1
- package/build/lib/queryObserver.d.ts +3 -3
- package/build/lib/queryObserver.d.ts.map +1 -1
- package/build/lib/queryObserver.js.map +1 -1
- package/build/lib/queryObserver.legacy.cjs.map +1 -1
- package/build/lib/queryObserver.legacy.js.map +1 -1
- package/build/lib/retryer.cjs.map +1 -1
- package/build/lib/retryer.d.ts +1 -1
- package/build/lib/retryer.d.ts.map +1 -1
- package/build/lib/retryer.js.map +1 -1
- package/build/lib/retryer.legacy.cjs.map +1 -1
- package/build/lib/retryer.legacy.js.map +1 -1
- package/build/lib/tests/utils.d.ts +4 -3
- package/build/lib/tests/utils.d.ts.map +1 -1
- package/build/lib/types.d.ts +2 -2
- package/build/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hydration.ts +8 -0
- package/src/infiniteQueryBehavior.ts +1 -1
- package/src/infiniteQueryObserver.ts +7 -7
- package/src/mutation.ts +5 -5
- package/src/mutationCache.ts +5 -5
- package/src/mutationObserver.ts +5 -5
- package/src/queriesObserver.ts +4 -4
- package/src/query.ts +8 -8
- package/src/queryCache.ts +5 -5
- package/src/queryClient.ts +14 -14
- package/src/queryObserver.ts +13 -13
- package/src/retryer.ts +1 -1
- package/src/tests/focusManager.test.tsx +1 -1
- package/src/tests/hydration.test.tsx +114 -3
- package/src/tests/infiniteQueryBehavior.test.tsx +3 -3
- package/src/tests/infiniteQueryObserver.test.tsx +2 -2
- package/src/tests/mutationCache.test.tsx +2 -2
- package/src/tests/mutationObserver.test.tsx +2 -2
- package/src/tests/mutations.test.tsx +4 -4
- package/src/tests/notifyManager.test.tsx +1 -1
- package/src/tests/onlineManager.test.tsx +1 -1
- package/src/tests/queriesObserver.test.tsx +3 -3
- package/src/tests/query.test.tsx +6 -6
- package/src/tests/queryCache.test.tsx +2 -2
- package/src/tests/queryClient.test.tsx +10 -10
- package/src/tests/queryObserver.test.tsx +3 -3
- package/src/tests/utils.test.tsx +6 -6
- package/src/tests/utils.ts +6 -4
- package/src/types.ts +2 -2
package/src/retryer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { focusManager } from './focusManager'
|
|
2
2
|
import { onlineManager } from './onlineManager'
|
|
3
3
|
import { sleep } from './utils'
|
|
4
|
-
import type { CancelOptions,
|
|
4
|
+
import type { CancelOptions, DefaultError, NetworkMode } from './types'
|
|
5
5
|
|
|
6
6
|
// TYPES
|
|
7
7
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { expect, vi } from 'vitest'
|
|
2
|
+
import { QueryCache } from '../queryCache'
|
|
3
|
+
import { dehydrate, hydrate } from '../hydration'
|
|
4
|
+
import { MutationCache } from '../mutationCache'
|
|
1
5
|
import {
|
|
2
6
|
createQueryClient,
|
|
3
7
|
executeMutation,
|
|
4
8
|
mockNavigatorOnLine,
|
|
5
9
|
sleep,
|
|
6
10
|
} from './utils'
|
|
7
|
-
import { QueryCache } from '../queryCache'
|
|
8
|
-
import { dehydrate, hydrate } from '../hydration'
|
|
9
|
-
import { vi } from 'vitest'
|
|
10
11
|
|
|
11
12
|
async function fetchData<TData>(value: TData, ms?: number): Promise<TData> {
|
|
12
13
|
await sleep(ms || 0)
|
|
@@ -557,4 +558,114 @@ describe('dehydration and rehydration', () => {
|
|
|
557
558
|
hydrationCache.find({ queryKey: ['string'] })?.state.fetchStatus,
|
|
558
559
|
).toBe('idle')
|
|
559
560
|
})
|
|
561
|
+
|
|
562
|
+
test('should dehydrate and hydrate meta for queries', async () => {
|
|
563
|
+
const queryCache = new QueryCache()
|
|
564
|
+
const queryClient = createQueryClient({ queryCache })
|
|
565
|
+
await queryClient.prefetchQuery({
|
|
566
|
+
queryKey: ['meta'],
|
|
567
|
+
queryFn: () => Promise.resolve('meta'),
|
|
568
|
+
meta: {
|
|
569
|
+
some: 'meta',
|
|
570
|
+
},
|
|
571
|
+
})
|
|
572
|
+
await queryClient.prefetchQuery({
|
|
573
|
+
queryKey: ['no-meta'],
|
|
574
|
+
queryFn: () => Promise.resolve('no-meta'),
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
const dehydrated = dehydrate(queryClient)
|
|
578
|
+
|
|
579
|
+
expect(
|
|
580
|
+
dehydrated.queries.find((q) => q.queryHash === '["meta"]')?.meta,
|
|
581
|
+
).toEqual({
|
|
582
|
+
some: 'meta',
|
|
583
|
+
})
|
|
584
|
+
|
|
585
|
+
expect(
|
|
586
|
+
dehydrated.queries.find((q) => q.queryHash === '["no-meta"]')?.meta,
|
|
587
|
+
).toEqual(undefined)
|
|
588
|
+
|
|
589
|
+
expect(
|
|
590
|
+
Object.keys(
|
|
591
|
+
dehydrated.queries.find((q) => q.queryHash === '["no-meta"]')!,
|
|
592
|
+
),
|
|
593
|
+
).not.toEqual(expect.arrayContaining(['meta']))
|
|
594
|
+
|
|
595
|
+
const stringified = JSON.stringify(dehydrated)
|
|
596
|
+
|
|
597
|
+
// ---
|
|
598
|
+
|
|
599
|
+
const parsed = JSON.parse(stringified)
|
|
600
|
+
const hydrationCache = new QueryCache()
|
|
601
|
+
const hydrationClient = createQueryClient({
|
|
602
|
+
queryCache: hydrationCache,
|
|
603
|
+
})
|
|
604
|
+
hydrate(hydrationClient, parsed)
|
|
605
|
+
expect(hydrationCache.find({ queryKey: ['meta'] })?.meta).toEqual({
|
|
606
|
+
some: 'meta',
|
|
607
|
+
})
|
|
608
|
+
expect(hydrationCache.find({ queryKey: ['no-meta'] })?.meta).toEqual(
|
|
609
|
+
undefined,
|
|
610
|
+
)
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
test('should dehydrate and hydrate meta for mutations', async () => {
|
|
614
|
+
const mutationCache = new MutationCache()
|
|
615
|
+
const queryClient = createQueryClient({ mutationCache })
|
|
616
|
+
|
|
617
|
+
await executeMutation(
|
|
618
|
+
queryClient,
|
|
619
|
+
{
|
|
620
|
+
mutationKey: ['meta'],
|
|
621
|
+
mutationFn: () => Promise.resolve('meta'),
|
|
622
|
+
meta: {
|
|
623
|
+
some: 'meta',
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
undefined,
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
await executeMutation(
|
|
630
|
+
queryClient,
|
|
631
|
+
{
|
|
632
|
+
mutationKey: ['no-meta'],
|
|
633
|
+
mutationFn: () => Promise.resolve('no-meta'),
|
|
634
|
+
},
|
|
635
|
+
undefined,
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
const dehydrated = dehydrate(queryClient, {
|
|
639
|
+
shouldDehydrateMutation: () => true,
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
expect(Object.keys(dehydrated.mutations[0]!)).toEqual(
|
|
643
|
+
expect.arrayContaining(['meta']),
|
|
644
|
+
)
|
|
645
|
+
expect(dehydrated.mutations[0]?.meta).toEqual({
|
|
646
|
+
some: 'meta',
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
expect(Object.keys(dehydrated.mutations[1]!)).not.toEqual(
|
|
650
|
+
expect.arrayContaining(['meta']),
|
|
651
|
+
)
|
|
652
|
+
expect(dehydrated.mutations[1]?.meta).toEqual(undefined)
|
|
653
|
+
|
|
654
|
+
const stringified = JSON.stringify(dehydrated)
|
|
655
|
+
|
|
656
|
+
// ---
|
|
657
|
+
|
|
658
|
+
const parsed = JSON.parse(stringified)
|
|
659
|
+
const hydrationCache = new MutationCache()
|
|
660
|
+
const hydrationClient = createQueryClient({
|
|
661
|
+
mutationCache: hydrationCache,
|
|
662
|
+
})
|
|
663
|
+
hydrate(hydrationClient, parsed)
|
|
664
|
+
expect(hydrationCache.find({ mutationKey: ['meta'] })?.meta).toEqual({
|
|
665
|
+
some: 'meta',
|
|
666
|
+
})
|
|
667
|
+
expect(hydrationCache.find({ mutationKey: ['no-meta'] })?.meta).toEqual(
|
|
668
|
+
undefined,
|
|
669
|
+
)
|
|
670
|
+
})
|
|
560
671
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react'
|
|
2
|
-
import type { QueryClient, QueryCache, InfiniteQueryObserverResult } from '..'
|
|
3
|
-
import { InfiniteQueryObserver, CancelledError } from '..'
|
|
4
|
-
import { createQueryClient, queryKey, sleep } from './utils'
|
|
5
2
|
import { vi } from 'vitest'
|
|
3
|
+
import { CancelledError, InfiniteQueryObserver } from '..'
|
|
4
|
+
import { createQueryClient, queryKey, sleep } from './utils'
|
|
5
|
+
import type { InfiniteQueryObserverResult, QueryCache, QueryClient } from '..'
|
|
6
6
|
|
|
7
7
|
describe('InfiniteQueryBehavior', () => {
|
|
8
8
|
let queryClient: QueryClient
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { vi } from 'vitest'
|
|
2
|
+
import { InfiniteQueryObserver } from '..'
|
|
1
3
|
import { createQueryClient, queryKey, sleep } from './utils'
|
|
2
4
|
import type { QueryClient } from '..'
|
|
3
|
-
import { InfiniteQueryObserver } from '..'
|
|
4
|
-
import { vi } from 'vitest'
|
|
5
5
|
|
|
6
6
|
describe('InfiniteQueryObserver', () => {
|
|
7
7
|
let queryClient: QueryClient
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react'
|
|
2
|
-
import { queryKey, sleep, executeMutation, createQueryClient } from './utils'
|
|
3
|
-
import { MutationCache, MutationObserver } from '..'
|
|
4
2
|
import { vi } from 'vitest'
|
|
3
|
+
import { MutationCache, MutationObserver } from '..'
|
|
4
|
+
import { createQueryClient, executeMutation, queryKey, sleep } from './utils'
|
|
5
5
|
|
|
6
6
|
describe('mutationCache', () => {
|
|
7
7
|
describe('MutationCacheConfig error callbacks', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react'
|
|
2
|
+
import { vi } from 'vitest'
|
|
3
|
+
import { MutationObserver } from '..'
|
|
2
4
|
import { createQueryClient, sleep } from './utils'
|
|
3
5
|
import type { QueryClient } from '..'
|
|
4
|
-
import { MutationObserver } from '..'
|
|
5
|
-
import { vi } from 'vitest'
|
|
6
6
|
|
|
7
7
|
describe('mutationObserver', () => {
|
|
8
8
|
let queryClient: QueryClient
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { QueryClient } from '..'
|
|
2
|
-
import { createQueryClient, executeMutation, queryKey, sleep } from './utils'
|
|
3
|
-
import type { MutationState } from '../mutation'
|
|
4
|
-
import { MutationObserver } from '../mutationObserver'
|
|
5
1
|
import { vi } from 'vitest'
|
|
6
2
|
import { waitFor } from '@testing-library/react'
|
|
3
|
+
import { MutationObserver } from '../mutationObserver'
|
|
4
|
+
import { createQueryClient, executeMutation, queryKey, sleep } from './utils'
|
|
5
|
+
import type { QueryClient } from '..'
|
|
6
|
+
import type { MutationState } from '../mutation'
|
|
7
7
|
|
|
8
8
|
describe('mutations', () => {
|
|
9
9
|
let queryClient: QueryClient
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react'
|
|
2
|
-
import { sleep, queryKey, createQueryClient } from './utils'
|
|
3
|
-
import type { QueryClient, QueryObserverResult } from '..'
|
|
4
|
-
import { QueriesObserver } from '..'
|
|
5
2
|
import { vi } from 'vitest'
|
|
3
|
+
import { QueriesObserver } from '..'
|
|
4
|
+
import { createQueryClient, queryKey, sleep } from './utils'
|
|
5
|
+
import type { QueryClient, QueryObserverResult } from '..'
|
|
6
6
|
|
|
7
7
|
describe('queriesObserver', () => {
|
|
8
8
|
let queryClient: QueryClient
|
package/src/tests/query.test.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { waitFor } from '@testing-library/react'
|
|
2
|
+
import { vi } from 'vitest'
|
|
3
|
+
import { QueryObserver, isCancelledError, onlineManager } from '..'
|
|
1
4
|
import {
|
|
2
|
-
sleep,
|
|
3
|
-
queryKey,
|
|
4
|
-
mockVisibilityState,
|
|
5
5
|
createQueryClient,
|
|
6
|
+
mockVisibilityState,
|
|
7
|
+
queryKey,
|
|
8
|
+
sleep,
|
|
6
9
|
} from './utils'
|
|
7
10
|
import type {
|
|
8
11
|
QueryCache,
|
|
@@ -10,9 +13,6 @@ import type {
|
|
|
10
13
|
QueryFunctionContext,
|
|
11
14
|
QueryObserverResult,
|
|
12
15
|
} from '..'
|
|
13
|
-
import { QueryObserver, isCancelledError, onlineManager } from '..'
|
|
14
|
-
import { waitFor } from '@testing-library/react'
|
|
15
|
-
import { vi } from 'vitest'
|
|
16
16
|
|
|
17
17
|
describe('query', () => {
|
|
18
18
|
let queryClient: QueryClient
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sleep, queryKey, createQueryClient } from './utils'
|
|
2
|
-
import { QueryClient, QueryCache, QueryObserver } from '..'
|
|
3
1
|
import { waitFor } from '@testing-library/react'
|
|
4
2
|
import { vi } from 'vitest'
|
|
3
|
+
import { QueryCache, QueryClient, QueryObserver } from '..'
|
|
4
|
+
import { createQueryClient, queryKey, sleep } from './utils'
|
|
5
5
|
|
|
6
6
|
describe('queryCache', () => {
|
|
7
7
|
let queryClient: QueryClient
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react'
|
|
2
2
|
import '@testing-library/jest-dom'
|
|
3
3
|
|
|
4
|
+
import { vi } from 'vitest'
|
|
5
|
+
import {
|
|
6
|
+
MutationObserver,
|
|
7
|
+
QueryObserver,
|
|
8
|
+
focusManager,
|
|
9
|
+
onlineManager,
|
|
10
|
+
} from '..'
|
|
11
|
+
import { noop } from '../utils'
|
|
4
12
|
import {
|
|
5
|
-
sleep,
|
|
6
|
-
queryKey,
|
|
7
13
|
createQueryClient,
|
|
8
14
|
mockNavigatorOnLine,
|
|
15
|
+
queryKey,
|
|
16
|
+
sleep,
|
|
9
17
|
} from './utils'
|
|
10
18
|
import type {
|
|
11
19
|
QueryCache,
|
|
@@ -13,14 +21,6 @@ import type {
|
|
|
13
21
|
QueryFunction,
|
|
14
22
|
QueryObserverOptions,
|
|
15
23
|
} from '..'
|
|
16
|
-
import {
|
|
17
|
-
MutationObserver,
|
|
18
|
-
QueryObserver,
|
|
19
|
-
focusManager,
|
|
20
|
-
onlineManager,
|
|
21
|
-
} from '..'
|
|
22
|
-
import { noop } from '../utils'
|
|
23
|
-
import { vi } from 'vitest'
|
|
24
24
|
|
|
25
25
|
describe('queryClient', () => {
|
|
26
26
|
let queryClient: QueryClient
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sleep, queryKey, expectType, createQueryClient } from './utils'
|
|
2
|
-
import type { QueryClient, QueryObserverResult } from '..'
|
|
3
|
-
import { QueryObserver, focusManager } from '..'
|
|
4
1
|
import { vi } from 'vitest'
|
|
2
|
+
import { QueryObserver, focusManager } from '..'
|
|
3
|
+
import { createQueryClient, expectType, queryKey, sleep } from './utils'
|
|
4
|
+
import type { QueryClient, QueryObserverResult } from '..'
|
|
5
5
|
|
|
6
6
|
describe('queryObserver', () => {
|
|
7
7
|
let queryClient: QueryClient
|
package/src/tests/utils.test.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { vi } from 'vitest'
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
addToEnd,
|
|
4
|
+
addToStart,
|
|
5
|
+
isPlainArray,
|
|
4
6
|
isPlainObject,
|
|
5
7
|
matchMutation,
|
|
8
|
+
partialMatchKey,
|
|
9
|
+
replaceEqualDeep,
|
|
6
10
|
scheduleMicrotask,
|
|
7
11
|
sleep,
|
|
8
|
-
isPlainArray,
|
|
9
|
-
addToEnd,
|
|
10
|
-
addToStart,
|
|
11
12
|
} from '../utils'
|
|
12
13
|
import { Mutation } from '../mutation'
|
|
13
14
|
import { createQueryClient } from './utils'
|
|
14
|
-
import { vi } from 'vitest'
|
|
15
15
|
|
|
16
16
|
describe('core/utils', () => {
|
|
17
17
|
describe('isPlainObject', () => {
|
package/src/tests/utils.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { act } from '@testing-library/react'
|
|
2
2
|
import { vi } from 'vitest'
|
|
3
|
-
|
|
4
|
-
import type { MutationOptions, QueryClientConfig } from '..'
|
|
5
3
|
import { QueryClient } from '..'
|
|
6
4
|
import * as utils from '../utils'
|
|
5
|
+
import type { SpyInstance } from 'vitest'
|
|
6
|
+
import type { MutationOptions, QueryClientConfig } from '..'
|
|
7
7
|
|
|
8
8
|
export function createQueryClient(config?: QueryClientConfig): QueryClient {
|
|
9
9
|
return new QueryClient(config)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function mockVisibilityState(
|
|
12
|
+
export function mockVisibilityState(
|
|
13
|
+
value: DocumentVisibilityState,
|
|
14
|
+
): SpyInstance<[], DocumentVisibilityState> {
|
|
13
15
|
return vi.spyOn(document, 'visibilityState', 'get').mockReturnValue(value)
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
export function mockNavigatorOnLine(value: boolean) {
|
|
18
|
+
export function mockNavigatorOnLine(value: boolean): SpyInstance<[], boolean> {
|
|
17
19
|
return vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(value)
|
|
18
20
|
}
|
|
19
21
|
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
3
|
import type { MutationState } from './mutation'
|
|
4
|
-
import type { FetchDirection,
|
|
5
|
-
import type {
|
|
4
|
+
import type { FetchDirection, Query, QueryBehavior } from './query'
|
|
5
|
+
import type { RetryDelayValue, RetryValue } from './retryer'
|
|
6
6
|
import type { QueryFilters, QueryTypeFilter } from './utils'
|
|
7
7
|
import type { QueryCache } from './queryCache'
|
|
8
8
|
import type { MutationCache } from './mutationCache'
|