@tanstack/svelte-query 6.3.6 → 6.3.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/HydrationBoundary.svelte +1 -1
- package/dist/createInfiniteQuery.d.ts +4 -2
- package/dist/createInfiniteQuery.d.ts.map +1 -1
- package/dist/createQuery.d.ts +3 -3
- package/dist/infiniteQueryOptions.d.ts +4 -3
- package/dist/infiniteQueryOptions.d.ts.map +1 -1
- package/dist/queryOptions.d.ts +8 -7
- package/dist/queryOptions.d.ts.map +1 -1
- package/dist/useIsFetching.svelte.d.ts +1 -1
- package/dist/useIsFetching.svelte.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/HydrationBoundary.svelte +1 -1
- package/src/createInfiniteQuery.ts +4 -2
- package/src/createQuery.ts +3 -3
- package/src/infiniteQueryOptions.ts +4 -3
- package/src/queryOptions.ts +8 -7
- package/src/useIsFetching.svelte.ts +1 -1
|
@@ -7,7 +7,8 @@ import type { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOpt
|
|
|
7
7
|
*
|
|
8
8
|
* This overload is selected when `initialData` is known to be defined.
|
|
9
9
|
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
10
|
-
* `createInfiniteQuery`, with `initialData`
|
|
10
|
+
* `createInfiniteQuery`, with `initialData` known to be defined, wrapped in an {@link Accessor} so options
|
|
11
|
+
* can be reactive.
|
|
11
12
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
12
13
|
* be used.
|
|
13
14
|
* @returns The current query result, plus `fetchNextPage`/`fetchPreviousPage`/`hasNextPage`/`hasPreviousPage`
|
|
@@ -20,7 +21,8 @@ export declare function createInfiniteQuery<TQueryFnData = unknown, TError = Def
|
|
|
20
21
|
* The options for `createInfiniteQuery` are identical to `createQuery`, with the addition of
|
|
21
22
|
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
22
23
|
*
|
|
23
|
-
* This overload is selected when `initialData` is omitted
|
|
24
|
+
* This overload is selected when `initialData` is omitted, may be `undefined`, or is a function that may
|
|
25
|
+
* return `undefined`.
|
|
24
26
|
* @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
25
27
|
* `createInfiniteQuery`, wrapped in an {@link Accessor} so options can be reactive.
|
|
26
28
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/createInfiniteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EAET,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,QAAQ,EACR,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EACjC,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,iCAAiC,EACjC,mCAAmC,EACpC,MAAM,2BAA2B,CAAA;AAElC
|
|
1
|
+
{"version":3,"file":"createInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/createInfiniteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EAET,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,QAAQ,EACR,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EACjC,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,iCAAiC,EACjC,mCAAmC,EACpC,MAAM,2BAA2B,CAAA;AAElC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,QAAQ,CACf,iCAAiC,CAC/B,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,CACF,EACD,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,gCAAgC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,QAAQ,CACf,mCAAmC,CACjC,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,CACF,EACD,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EACZ,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,QAAQ,CACf,0BAA0B,CACxB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,CACF,EACD,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA"}
|
package/dist/createQuery.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import type { DefinedInitialDataOptions, UndefinedInitialDataOptions } from './q
|
|
|
5
5
|
* Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
6
6
|
* The query runs when the options call for it — `enabled: false` skips the initial fetch.
|
|
7
7
|
*
|
|
8
|
-
* This overload is selected when `initialData` is
|
|
9
|
-
* a `select` changes `TData` to include `undefined`).
|
|
8
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
9
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
10
10
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
11
|
-
* with `initialData`
|
|
11
|
+
* with `initialData` known to be defined, wrapped in an {@link Accessor} so options can be reactive.
|
|
12
12
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
13
13
|
* be used.
|
|
14
14
|
* @returns The current query result, typed so that `status` is `success` — or `error` if a fetch attempt
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { DefaultError, InfiniteData, InitialDataFunction, NonUndefinedGuard, QueryKey, QueryKeyWithDataTag } from '@tanstack/query-core';
|
|
2
2
|
import type { CreateInfiniteQueryOptions } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is omitted
|
|
5
|
-
*
|
|
4
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is omitted, may be
|
|
5
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
6
|
+
* `pending`.
|
|
6
7
|
*/
|
|
7
8
|
export type UndefinedInitialDataInfiniteOptions<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
|
|
8
9
|
initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>;
|
|
@@ -21,7 +22,7 @@ export type DefinedInitialDataInfiniteOptions<TQueryFnData = unknown, TError = D
|
|
|
21
22
|
*
|
|
22
23
|
* This overload is selected when `initialData` is known to be defined.
|
|
23
24
|
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
24
|
-
* `createInfiniteQuery`, with `initialData`
|
|
25
|
+
* `createInfiniteQuery`, with `initialData` known to be defined.
|
|
25
26
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
26
27
|
* @see {@link createInfiniteQuery} to run an infinite query with these options.
|
|
27
28
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infiniteQueryOptions.d.ts","sourceRoot":"","sources":["../src/infiniteQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAE5D
|
|
1
|
+
{"version":3,"file":"infiniteQueryOptions.d.ts","sourceRoot":"","sources":["../src/infiniteQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAE5D;;;;GAIG;AACH,MAAM,MAAM,mCAAmC,CAC7C,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,IAClB,0BAA0B,CAC5B,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,GAAG;IACF,WAAW,CAAC,EACR,SAAS,GACT,iBAA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AAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,mCAAmC,CAC1C,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,GACA,mCAAmC,CACpC,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,GACC,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAA"}
|
package/dist/queryOptions.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { DefaultError, InitialDataFunction, NonUndefinedGuard, QueryKey, QueryKeyWithDataTag } from '@tanstack/query-core';
|
|
2
2
|
import type { CreateQueryOptions } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* The options accepted by the `queryOptions` overload selected when `initialData` is omitted
|
|
5
|
-
* `undefined` — `data` may be `undefined` while the query is
|
|
4
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be
|
|
5
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
6
|
+
* `pending`.
|
|
6
7
|
*/
|
|
7
8
|
export type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
8
9
|
initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
* The options accepted by the `queryOptions` overload selected when `initialData` is
|
|
12
|
-
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
12
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —
|
|
13
|
+
* `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
13
14
|
*/
|
|
14
15
|
export type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
15
16
|
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
|
|
@@ -19,10 +20,10 @@ export type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultEr
|
|
|
19
20
|
* can be shared across `createQuery` calls and imperative APIs such as `queryClient.query`. `options.queryKey`
|
|
20
21
|
* is required and is the query key to generate options for.
|
|
21
22
|
*
|
|
22
|
-
* This overload is selected when `initialData` is
|
|
23
|
-
* a `select` changes `TData` to include `undefined`).
|
|
23
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
24
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
24
25
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
25
|
-
* with `initialData`
|
|
26
|
+
* with `initialData` known to be defined.
|
|
26
27
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
27
28
|
* @see {@link createQuery} to run a query with these options.
|
|
28
29
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryOptions.d.ts","sourceRoot":"","sources":["../src/queryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD
|
|
1
|
+
{"version":3,"file":"queryOptions.d.ts","sourceRoot":"","sources":["../src/queryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;A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,YAAY,EACpB,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAErC,OAAO,EAAE,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,GAC3E,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,GACpE,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA"}
|
|
@@ -35,5 +35,5 @@ import type { QueryClient, QueryFilters } from '@tanstack/query-core';
|
|
|
35
35
|
* {/if}
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): ReactiveValue<number>;
|
|
38
|
+
export declare function useIsFetching(filters?: Omit<QueryFilters, 'fetchStatus'>, queryClient?: QueryClient): ReactiveValue<number>;
|
|
39
39
|
//# sourceMappingURL=useIsFetching.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.svelte.d.ts","sourceRoot":"","sources":["../src/useIsFetching.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"useIsFetching.svelte.d.ts","sourceRoot":"","sources":["../src/useIsFetching.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,EAC3C,WAAW,CAAC,EAAE,WAAW,GACxB,aAAa,CAAC,MAAM,CAAC,CAQvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-query",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.7",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Svelte",
|
|
5
5
|
"author": "Lachlan Collins",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"!src/__tests__"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@tanstack/query-core": "5.105.
|
|
42
|
+
"@tanstack/query-core": "5.105.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@typescript-eslint/parser": "^8.72.0",
|
|
50
50
|
"eslint-plugin-svelte": "^3.23.0",
|
|
51
51
|
"svelte": "^5.57.1",
|
|
52
|
-
"svelte-check": "^4.
|
|
52
|
+
"svelte-check": "^4.7.7",
|
|
53
53
|
"typescript": "6.0.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
@@ -24,7 +24,8 @@ import type {
|
|
|
24
24
|
*
|
|
25
25
|
* This overload is selected when `initialData` is known to be defined.
|
|
26
26
|
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
27
|
-
* `createInfiniteQuery`, with `initialData`
|
|
27
|
+
* `createInfiniteQuery`, with `initialData` known to be defined, wrapped in an {@link Accessor} so options
|
|
28
|
+
* can be reactive.
|
|
28
29
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
29
30
|
* be used.
|
|
30
31
|
* @returns The current query result, plus `fetchNextPage`/`fetchPreviousPage`/`hasNextPage`/`hasPreviousPage`
|
|
@@ -55,7 +56,8 @@ export function createInfiniteQuery<
|
|
|
55
56
|
* The options for `createInfiniteQuery` are identical to `createQuery`, with the addition of
|
|
56
57
|
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
57
58
|
*
|
|
58
|
-
* This overload is selected when `initialData` is omitted
|
|
59
|
+
* This overload is selected when `initialData` is omitted, may be `undefined`, or is a function that may
|
|
60
|
+
* return `undefined`.
|
|
59
61
|
* @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
60
62
|
* `createInfiniteQuery`, wrapped in an {@link Accessor} so options can be reactive.
|
|
61
63
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
package/src/createQuery.ts
CHANGED
|
@@ -16,10 +16,10 @@ import type {
|
|
|
16
16
|
* Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
17
17
|
* The query runs when the options call for it — `enabled: false` skips the initial fetch.
|
|
18
18
|
*
|
|
19
|
-
* This overload is selected when `initialData` is
|
|
20
|
-
* a `select` changes `TData` to include `undefined`).
|
|
19
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
20
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
21
21
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
22
|
-
* with `initialData`
|
|
22
|
+
* with `initialData` known to be defined, wrapped in an {@link Accessor} so options can be reactive.
|
|
23
23
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
24
24
|
* be used.
|
|
25
25
|
* @returns The current query result, typed so that `status` is `success` — or `error` if a fetch attempt
|
|
@@ -9,8 +9,9 @@ import type {
|
|
|
9
9
|
import type { CreateInfiniteQueryOptions } from './types.js'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is omitted
|
|
13
|
-
*
|
|
12
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is omitted, may be
|
|
13
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
14
|
+
* `pending`.
|
|
14
15
|
*/
|
|
15
16
|
export type UndefinedInitialDataInfiniteOptions<
|
|
16
17
|
TQueryFnData = unknown,
|
|
@@ -62,7 +63,7 @@ export type DefinedInitialDataInfiniteOptions<
|
|
|
62
63
|
*
|
|
63
64
|
* This overload is selected when `initialData` is known to be defined.
|
|
64
65
|
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
65
|
-
* `createInfiniteQuery`, with `initialData`
|
|
66
|
+
* `createInfiniteQuery`, with `initialData` known to be defined.
|
|
66
67
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
67
68
|
* @see {@link createInfiniteQuery} to run an infinite query with these options.
|
|
68
69
|
* @example
|
package/src/queryOptions.ts
CHANGED
|
@@ -8,8 +8,9 @@ import type {
|
|
|
8
8
|
import type { CreateQueryOptions } from './types.js'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The options accepted by the `queryOptions` overload selected when `initialData` is omitted
|
|
12
|
-
* `undefined` — `data` may be `undefined` while the query is
|
|
11
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be
|
|
12
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
13
|
+
* `pending`.
|
|
13
14
|
*/
|
|
14
15
|
export type UndefinedInitialDataOptions<
|
|
15
16
|
TQueryFnData = unknown,
|
|
@@ -24,8 +25,8 @@ export type UndefinedInitialDataOptions<
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
|
-
* The options accepted by the `queryOptions` overload selected when `initialData` is
|
|
28
|
-
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
28
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —
|
|
29
|
+
* `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
29
30
|
*/
|
|
30
31
|
export type DefinedInitialDataOptions<
|
|
31
32
|
TQueryFnData = unknown,
|
|
@@ -43,10 +44,10 @@ export type DefinedInitialDataOptions<
|
|
|
43
44
|
* can be shared across `createQuery` calls and imperative APIs such as `queryClient.query`. `options.queryKey`
|
|
44
45
|
* is required and is the query key to generate options for.
|
|
45
46
|
*
|
|
46
|
-
* This overload is selected when `initialData` is
|
|
47
|
-
* a `select` changes `TData` to include `undefined`).
|
|
47
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
48
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
48
49
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
49
|
-
* with `initialData`
|
|
50
|
+
* with `initialData` known to be defined.
|
|
50
51
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
51
52
|
* @see {@link createQuery} to run a query with these options.
|
|
52
53
|
* @example
|
|
@@ -38,7 +38,7 @@ import type { QueryClient, QueryFilters } from '@tanstack/query-core'
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
export function useIsFetching(
|
|
41
|
-
filters?: QueryFilters,
|
|
41
|
+
filters?: Omit<QueryFilters, 'fetchStatus'>,
|
|
42
42
|
queryClient?: QueryClient,
|
|
43
43
|
): ReactiveValue<number> {
|
|
44
44
|
const client = useQueryClient(queryClient)
|