Skip to content

Commit 8a4853b

Browse files
authored
Merge branch 'alpha' into alpha/fix-5538
2 parents 78d45f7 + 12318b4 commit 8a4853b

File tree

33 files changed

+2273
-1498
lines changed

33 files changed

+2273
-1498
lines changed

docs/react/reference/QueryClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ function Component() {
527527

528528
**Options**
529529

530-
- `mutationKey: string | unknown[]`
530+
- `mutationKey: unknown[]`
531531
- `options: MutationOptions`
532532

533533
> Similar to [`setQueryDefaults`](#queryclientsetquerydefaults), the order of registration does matter here.

docs/react/reference/useMutation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mutate(variables, {
5151
- `gcTime: number | Infinity`
5252
- The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used.
5353
- If set to `Infinity`, will disable garbage collection
54-
- `mutationKey: string`
54+
- `mutationKey: unknown[]`
5555
- Optional
5656
- A mutation key can be set to inherit defaults set with `queryClient.setMutationDefaults` or to identify the mutation in the devtools.
5757
- `networkMode: 'online' | 'always' | 'offlineFirst`

examples/react/react-native/src/hooks/useAppState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { AppState, AppStateStatus } from 'react-native'
33

44
export function useAppState(onChange: (status: AppStateStatus) => void) {
55
useEffect(() => {
6-
AppState.addEventListener('change', onChange)
6+
const subscription = AppState.addEventListener('change', onChange)
77
return () => {
8-
AppState.removeEventListener('change', onChange)
8+
subscription.remove()
99
}
1010
}, [onChange])
1111
}

packages/query-async-storage-persister/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/query-async-storage-persister",
3-
"version": "5.0.0-alpha.68",
3+
"version": "5.0.0-alpha.70",
44
"description": "A persister for asynchronous storages, to be used with TanStack/Query",
55
"author": "tannerlinsley",
66
"license": "MIT",

packages/query-broadcast-client-experimental/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/query-broadcast-client-experimental",
3-
"version": "5.0.0-alpha.68",
3+
"version": "5.0.0-alpha.70",
44
"description": "An experimental plugin to for broadcasting the state of your queryClient between browser tabs/windows",
55
"author": "tannerlinsley",
66
"license": "MIT",

packages/query-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/query-core",
3-
"version": "5.0.0-alpha.66",
3+
"version": "5.0.0-alpha.70",
44
"description": "The framework agnostic core that powers TanStack Query",
55
"author": "tannerlinsley",
66
"license": "MIT",

packages/query-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
export { CancelledError } from './retryer'
44
export { QueryCache } from './queryCache'
5+
export type { QueryCacheNotifyEvent } from './queryCache'
56
export { QueryClient } from './queryClient'
67
export { QueryObserver } from './queryObserver'
78
export { QueriesObserver } from './queriesObserver'

packages/query-core/src/infiniteQueryBehavior.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export function infiniteQueryBehavior<TQueryFnData, TError, TData>(
3939
// Get query function
4040
const queryFn =
4141
context.options.queryFn ||
42-
(() => Promise.reject(new Error('Missing queryFn')))
42+
(() =>
43+
Promise.reject(
44+
new Error(`Missing queryFn: '${context.options.queryHash}'`),
45+
))
4346

4447
// Create function to fetch a page
4548
const fetchPage = async (

packages/query-core/src/notifyManager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ type NotifyFunction = (callback: () => void) => void
88

99
type BatchNotifyFunction = (callback: () => void) => void
1010

11+
type BatchCallsCallback<T extends unknown[]> = (...args: T) => void
12+
1113
export function createNotifyManager() {
1214
let queue: NotifyCallback[] = []
1315
let transactions = 0
@@ -45,12 +47,14 @@ export function createNotifyManager() {
4547
/**
4648
* All calls to the wrapped function will be batched.
4749
*/
48-
const batchCalls = <T extends Function>(callback: T): T => {
49-
return ((...args: any[]) => {
50+
const batchCalls = <T extends unknown[]>(
51+
callback: BatchCallsCallback<T>,
52+
): BatchCallsCallback<T> => {
53+
return (...args) => {
5054
schedule(() => {
5155
callback(...args)
5256
})
53-
}) as any
57+
}
5458
}
5559

5660
const flush = (): void => {

packages/query-core/src/query.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ export class Query<
387387
// Create fetch function
388388
const fetchFn = () => {
389389
if (!this.options.queryFn) {
390-
return Promise.reject(new Error('Missing queryFn'))
390+
return Promise.reject(
391+
new Error(`Missing queryFn: '${this.options.queryHash}'`),
392+
)
391393
}
392394
this.#abortSignalConsumed = false
393395
return this.options.queryFn(

0 commit comments

Comments
 (0)