@tanstack/react-query 4.3.8 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/Hydrate.d.ts +2 -2
- package/build/lib/Hydrate.esm.js.map +1 -1
- package/build/lib/Hydrate.js.map +1 -1
- package/build/lib/Hydrate.mjs.map +1 -1
- package/build/lib/QueryClientProvider.d.ts +2 -2
- package/build/lib/QueryClientProvider.esm.js.map +1 -1
- package/build/lib/QueryClientProvider.js.map +1 -1
- package/build/lib/QueryClientProvider.mjs.map +1 -1
- package/build/lib/__tests__/utils.d.ts +2 -1
- package/build/lib/types.d.ts +2 -2
- package/build/lib/useBaseQuery.d.ts +2 -2
- package/build/lib/useBaseQuery.esm.js +1 -1
- package/build/lib/useBaseQuery.esm.js.map +1 -1
- package/build/lib/useBaseQuery.js +2 -2
- package/build/lib/useBaseQuery.js.map +1 -1
- package/build/lib/useBaseQuery.mjs +1 -1
- package/build/lib/useBaseQuery.mjs.map +1 -1
- package/build/lib/useInfiniteQuery.d.ts +2 -2
- package/build/lib/useInfiniteQuery.esm.js.map +1 -1
- package/build/lib/useInfiniteQuery.js.map +1 -1
- package/build/lib/useInfiniteQuery.mjs.map +1 -1
- package/build/lib/useIsFetching.d.ts +2 -2
- package/build/lib/useIsFetching.esm.js +1 -1
- package/build/lib/useIsFetching.esm.js.map +1 -1
- package/build/lib/useIsFetching.js +2 -2
- package/build/lib/useIsFetching.js.map +1 -1
- package/build/lib/useIsFetching.mjs +1 -1
- package/build/lib/useIsFetching.mjs.map +1 -1
- package/build/lib/useIsMutating.d.ts +2 -2
- package/build/lib/useIsMutating.esm.js +1 -1
- package/build/lib/useIsMutating.esm.js.map +1 -1
- package/build/lib/useIsMutating.js +2 -2
- package/build/lib/useIsMutating.js.map +1 -1
- package/build/lib/useIsMutating.mjs +1 -1
- package/build/lib/useIsMutating.mjs.map +1 -1
- package/build/lib/useMutation.d.ts +2 -2
- package/build/lib/useMutation.esm.js +1 -1
- package/build/lib/useMutation.esm.js.map +1 -1
- package/build/lib/useMutation.js +2 -2
- package/build/lib/useMutation.js.map +1 -1
- package/build/lib/useMutation.mjs +1 -1
- package/build/lib/useMutation.mjs.map +1 -1
- package/build/lib/useQueries.d.ts +2 -2
- package/build/lib/useQueries.esm.js +1 -1
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +2 -2
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +1 -1
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQuery.d.ts +2 -2
- package/build/lib/useQuery.esm.js.map +1 -1
- package/build/lib/useQuery.js.map +1 -1
- package/build/lib/useQuery.mjs.map +1 -1
- package/build/lib/useSyncExternalStore.d.ts +2 -1
- package/build/lib/useSyncExternalStore.esm.js +7 -0
- package/build/lib/useSyncExternalStore.esm.js.map +1 -0
- package/build/lib/useSyncExternalStore.js +11 -0
- package/build/lib/useSyncExternalStore.js.map +1 -0
- package/build/lib/useSyncExternalStore.mjs +7 -0
- package/build/lib/useSyncExternalStore.mjs.map +1 -0
- package/build/lib/useSyncExternalStore.native.d.ts +2 -1
- package/build/lib/useSyncExternalStore.native.esm.js +2 -0
- package/build/lib/useSyncExternalStore.native.esm.js.map +1 -0
- package/build/lib/useSyncExternalStore.native.js +13 -0
- package/build/lib/useSyncExternalStore.native.js.map +1 -0
- package/build/lib/useSyncExternalStore.native.mjs +2 -0
- package/build/lib/useSyncExternalStore.native.mjs.map +1 -0
- package/build/umd/index.development.js +8 -5
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Hydrate.tsx +3 -2
- package/src/QueryClientProvider.tsx +2 -2
- package/src/__tests__/suspense.test.tsx +1 -2
- package/src/__tests__/useInfiniteQuery.test.tsx +2 -3
- package/src/__tests__/useIsFetching.test.tsx +2 -1
- package/src/__tests__/useMutation.test.tsx +3 -2
- package/src/__tests__/useQueries.test.tsx +3 -5
- package/src/__tests__/useQuery.test.tsx +2 -3
- package/src/__tests__/utils.tsx +2 -7
- package/src/types.ts +2 -2
- package/src/useBaseQuery.ts +3 -2
- package/src/useInfiniteQuery.ts +3 -4
- package/src/useIsFetching.ts +3 -7
- package/src/useIsMutating.ts +3 -7
- package/src/useMutation.ts +2 -3
- package/src/useQueries.ts +3 -7
- package/src/useQuery.ts +7 -7
- package/src/useSyncExternalStore.native.ts +3 -1
- package/src/useSyncExternalStore.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-error-boundary": "^3.1.4"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@tanstack/query-core": "4.
|
|
50
|
+
"@tanstack/query-core": "4.4.0",
|
|
51
51
|
"use-sync-external-store": "^1.2.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
package/src/Hydrate.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { HydrateOptions } from '@tanstack/query-core'
|
|
4
|
+
import { hydrate } from '@tanstack/query-core'
|
|
4
5
|
import { useQueryClient } from './QueryClientProvider'
|
|
5
|
-
import { ContextOptions } from './types'
|
|
6
|
+
import type { ContextOptions } from './types'
|
|
6
7
|
|
|
7
8
|
export function useHydrate(
|
|
8
9
|
state: unknown,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
|
|
3
|
-
import { QueryClient } from '@tanstack/query-core'
|
|
4
|
-
import { ContextOptions } from './types'
|
|
3
|
+
import type { QueryClient } from '@tanstack/query-core'
|
|
4
|
+
import type { ContextOptions } from './types'
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
@@ -3,14 +3,13 @@ import { ErrorBoundary } from 'react-error-boundary'
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
|
|
5
5
|
import { createQueryClient, queryKey, renderWithClient, sleep } from './utils'
|
|
6
|
+
import type { UseInfiniteQueryResult, UseQueryResult } from '..'
|
|
6
7
|
import {
|
|
7
8
|
QueryCache,
|
|
8
9
|
QueryErrorResetBoundary,
|
|
9
10
|
useInfiniteQuery,
|
|
10
|
-
UseInfiniteQueryResult,
|
|
11
11
|
useQuery,
|
|
12
12
|
useQueryErrorResetBoundary,
|
|
13
|
-
UseQueryResult,
|
|
14
13
|
} from '..'
|
|
15
14
|
|
|
16
15
|
describe("useQuery's in Suspense mode", () => {
|
|
@@ -9,13 +9,12 @@ import {
|
|
|
9
9
|
setActTimeout,
|
|
10
10
|
sleep,
|
|
11
11
|
} from './utils'
|
|
12
|
-
import {
|
|
12
|
+
import type {
|
|
13
13
|
InfiniteData,
|
|
14
|
-
QueryCache,
|
|
15
14
|
QueryFunctionContext,
|
|
16
|
-
useInfiniteQuery,
|
|
17
15
|
UseInfiniteQueryResult,
|
|
18
16
|
} from '..'
|
|
17
|
+
import { QueryCache, useInfiniteQuery } from '..'
|
|
19
18
|
|
|
20
19
|
interface Result {
|
|
21
20
|
items: number[]
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
setActTimeout,
|
|
10
10
|
sleep,
|
|
11
11
|
} from './utils'
|
|
12
|
-
import {
|
|
12
|
+
import type { QueryClient } from '..'
|
|
13
|
+
import { QueryCache, useIsFetching, useQuery } from '..'
|
|
13
14
|
|
|
14
15
|
describe('useIsFetching', () => {
|
|
15
16
|
// See https://github.com/tannerlinsley/react-query/issues/105
|
|
@@ -3,8 +3,9 @@ import '@testing-library/jest-dom'
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { ErrorBoundary } from 'react-error-boundary'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import type { QueryClient } from '..'
|
|
7
|
+
import { MutationCache, QueryCache, useMutation } from '..'
|
|
8
|
+
import type { UseMutationResult } from '../types'
|
|
8
9
|
import {
|
|
9
10
|
createQueryClient,
|
|
10
11
|
mockNavigatorOnLine,
|
|
@@ -12,18 +12,16 @@ import {
|
|
|
12
12
|
renderWithClient,
|
|
13
13
|
sleep,
|
|
14
14
|
} from './utils'
|
|
15
|
-
import {
|
|
16
|
-
QueriesObserver,
|
|
17
|
-
QueryCache,
|
|
15
|
+
import type {
|
|
18
16
|
QueryClient,
|
|
19
17
|
QueryFunction,
|
|
20
18
|
QueryKey,
|
|
21
19
|
QueryObserverResult,
|
|
22
|
-
useQueries,
|
|
23
20
|
UseQueryOptions,
|
|
24
21
|
UseQueryResult,
|
|
25
22
|
} from '..'
|
|
26
|
-
import {
|
|
23
|
+
import { QueriesObserver, QueryCache, useQueries } from '..'
|
|
24
|
+
import type { QueryFunctionContext } from '@tanstack/query-core'
|
|
27
25
|
|
|
28
26
|
describe('useQueries', () => {
|
|
29
27
|
const queryCache = new QueryCache()
|
|
@@ -13,15 +13,14 @@ import {
|
|
|
13
13
|
setActTimeout,
|
|
14
14
|
sleep,
|
|
15
15
|
} from './utils'
|
|
16
|
-
import {
|
|
16
|
+
import type {
|
|
17
17
|
DefinedUseQueryResult,
|
|
18
|
-
QueryCache,
|
|
19
18
|
QueryFunction,
|
|
20
19
|
QueryFunctionContext,
|
|
21
|
-
useQuery,
|
|
22
20
|
UseQueryOptions,
|
|
23
21
|
UseQueryResult,
|
|
24
22
|
} from '..'
|
|
23
|
+
import { QueryCache, useQuery } from '..'
|
|
25
24
|
import { ErrorBoundary } from 'react-error-boundary'
|
|
26
25
|
|
|
27
26
|
describe('useQuery', () => {
|
package/src/__tests__/utils.tsx
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { act, render } from '@testing-library/react'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ContextOptions,
|
|
6
|
-
QueryClientProvider,
|
|
7
|
-
QueryClientConfig,
|
|
8
|
-
MutationOptions,
|
|
9
|
-
} from '..'
|
|
3
|
+
import type { ContextOptions, QueryClientConfig, MutationOptions } from '..'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '..'
|
|
10
5
|
import * as utils from '@tanstack/query-core'
|
|
11
6
|
|
|
12
7
|
export function renderWithClient(
|
package/src/types.ts
CHANGED
package/src/useBaseQuery.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
3
3
|
|
|
4
|
-
import { QueryKey,
|
|
4
|
+
import type { QueryKey, QueryObserver } from '@tanstack/query-core'
|
|
5
|
+
import { notifyManager } from '@tanstack/query-core'
|
|
5
6
|
import { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'
|
|
6
7
|
import { useQueryClient } from './QueryClientProvider'
|
|
7
|
-
import { UseBaseQueryOptions } from './types'
|
|
8
|
+
import type { UseBaseQueryOptions } from './types'
|
|
8
9
|
import { shouldThrowError } from './utils'
|
|
9
10
|
import { useIsRestoring } from './isRestoring'
|
|
10
11
|
|
package/src/useInfiniteQuery.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
QueryObserver,
|
|
3
|
-
InfiniteQueryObserver,
|
|
4
3
|
QueryFunction,
|
|
5
4
|
QueryKey,
|
|
6
|
-
parseQueryArgs,
|
|
7
5
|
} from '@tanstack/query-core'
|
|
8
|
-
import {
|
|
6
|
+
import { InfiniteQueryObserver, parseQueryArgs } from '@tanstack/query-core'
|
|
7
|
+
import type { UseInfiniteQueryOptions, UseInfiniteQueryResult } from './types'
|
|
9
8
|
import { useBaseQuery } from './useBaseQuery'
|
|
10
9
|
|
|
11
10
|
// HOOK
|
package/src/useIsFetching.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
notifyManager,
|
|
5
|
-
parseFilterArgs,
|
|
6
|
-
QueryFilters,
|
|
7
|
-
} from '@tanstack/query-core'
|
|
2
|
+
import type { QueryKey, QueryFilters } from '@tanstack/query-core'
|
|
3
|
+
import { notifyManager, parseFilterArgs } from '@tanstack/query-core'
|
|
8
4
|
|
|
9
5
|
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
10
|
-
import { ContextOptions } from './types'
|
|
6
|
+
import type { ContextOptions } from './types'
|
|
11
7
|
import { useQueryClient } from './QueryClientProvider'
|
|
12
8
|
|
|
13
9
|
interface Options extends ContextOptions {}
|
package/src/useIsMutating.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
MutationFilters,
|
|
8
|
-
parseMutationFilterArgs,
|
|
9
|
-
} from '@tanstack/query-core'
|
|
10
|
-
import { ContextOptions } from './types'
|
|
4
|
+
import type { MutationKey, MutationFilters } from '@tanstack/query-core'
|
|
5
|
+
import { notifyManager, parseMutationFilterArgs } from '@tanstack/query-core'
|
|
6
|
+
import type { ContextOptions } from './types'
|
|
11
7
|
import { useQueryClient } from './QueryClientProvider'
|
|
12
8
|
|
|
13
9
|
interface Options extends ContextOptions {}
|
package/src/useMutation.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
3
3
|
|
|
4
|
+
import type { MutationFunction, MutationKey } from '@tanstack/query-core'
|
|
4
5
|
import {
|
|
5
6
|
notifyManager,
|
|
6
7
|
parseMutationArgs,
|
|
7
8
|
MutationObserver,
|
|
8
|
-
MutationFunction,
|
|
9
|
-
MutationKey,
|
|
10
9
|
} from '@tanstack/query-core'
|
|
11
10
|
import { useQueryClient } from './QueryClientProvider'
|
|
12
|
-
import {
|
|
11
|
+
import type {
|
|
13
12
|
UseMutateFunction,
|
|
14
13
|
UseMutationOptions,
|
|
15
14
|
UseMutationResult,
|
package/src/useQueries.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
QueryFunction,
|
|
7
|
-
notifyManager,
|
|
8
|
-
QueriesObserver,
|
|
9
|
-
} from '@tanstack/query-core'
|
|
4
|
+
import type { QueryKey, QueryFunction } from '@tanstack/query-core'
|
|
5
|
+
import { notifyManager, QueriesObserver } from '@tanstack/query-core'
|
|
10
6
|
import { useQueryClient } from './QueryClientProvider'
|
|
11
|
-
import { UseQueryOptions, UseQueryResult } from './types'
|
|
7
|
+
import type { UseQueryOptions, UseQueryResult } from './types'
|
|
12
8
|
import { useIsRestoring } from './isRestoring'
|
|
13
9
|
|
|
14
10
|
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.
|
package/src/useQuery.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { QueryFunction, QueryKey } from '@tanstack/query-core'
|
|
2
|
+
import { parseQueryArgs, QueryObserver } from '@tanstack/query-core'
|
|
3
|
+
import type {
|
|
4
|
+
DefinedUseQueryResult,
|
|
5
|
+
UseQueryOptions,
|
|
6
|
+
UseQueryResult,
|
|
7
|
+
} from './types'
|
|
8
8
|
import { useBaseQuery } from './useBaseQuery'
|
|
9
9
|
|
|
10
10
|
// HOOK
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
|
|
2
2
|
// @ts-ignore
|
|
3
|
-
|
|
3
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js'
|
|
4
|
+
|
|
5
|
+
export { useSyncExternalStore }
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
|
|
2
|
-
|
|
2
|
+
import { useSyncExternalStore as uSES } from 'use-sync-external-store/shim/index.js'
|
|
3
|
+
|
|
4
|
+
export const useSyncExternalStore = uSES
|