- Svelte Reference
- Functions / createInfiniteQuery
- Functions / createMutation
- Functions / createQueries
- Functions / createQuery
- Functions / defaultShouldDehydrateMutation
- Functions / defaultShouldDehydrateQuery
- Functions / dehydrate
- Functions / dehydrateQuery
- Functions / experimental_streamedQuery
- Functions / getIsRestoringContext
- Functions / getQueryClientContext
- Functions / hashKey
- Functions / hydrate
- Functions / infiniteQueryOptions
- Functions / isCancelledError
- Functions / keepPreviousData
- Functions / matchMutation
- Functions / matchQuery
- Functions / mutationOptions
- Functions / noop
- Functions / partialMatchKey
- Functions / queryOptions
- Functions / replaceEqualDeep
- Functions / setIsRestoringContext
- Functions / setQueryClientContext
- Functions / shouldThrowError
- Functions / useHydrate
- Functions / useIsFetching
- Functions / useIsMutating
- Functions / useIsRestoring
- Functions / useMutationState
- Functions / useQueryClient
- Classes / CancelledError
- Classes / InfiniteQueryObserver
- Classes / Mutation
- Classes / MutationCache
- Classes / MutationObserver
- Classes / QueriesObserver
- Classes / Query
- Classes / QueryCache
- Classes / QueryClient
- Classes / QueryObserver
- Interfaces / CancelOptions
- Interfaces / DefaultOptions
- Interfaces / DehydrateOptions
- Interfaces / DehydratedState
- Interfaces / EnsureQueryDataOptions
- Interfaces / FetchNextPageOptions
- Interfaces / FetchPreviousPageOptions
- Interfaces / FetchQueryOptions
- Interfaces / FocusManager
- Interfaces / HydrateOptions
- Interfaces / InfiniteData
- Interfaces / InfiniteQueryObserverBaseResult
- Interfaces / InfiniteQueryObserverLoadingErrorResult
- Interfaces / InfiniteQueryObserverLoadingResult
- Interfaces / InfiniteQueryObserverOptions
- Interfaces / InfiniteQueryObserverPendingResult
- Interfaces / InfiniteQueryObserverPlaceholderResult
- Interfaces / InfiniteQueryObserverRefetchErrorResult
- Interfaces / InfiniteQueryObserverSuccessResult
- Interfaces / InfiniteQueryPageParamsOptions
- Interfaces / InitialPageParam
- Interfaces / InvalidateOptions
- Interfaces / InvalidateQueryFilters
- Interfaces / MutateOptions
- Interfaces / MutationCacheConfig
- Interfaces / MutationFilters
- Interfaces / MutationObserverBaseResult
- Interfaces / MutationObserverErrorResult
- Interfaces / MutationObserverIdleResult
- Interfaces / MutationObserverLoadingResult
- Interfaces / MutationObserverOptions
- Interfaces / MutationObserverSuccessResult
- Interfaces / MutationOptions
- Interfaces / MutationState
- Interfaces / NotifyEvent
- Interfaces / OnlineManager
- Interfaces / QueriesObserverOptions
- Interfaces / QueryCacheConfig
- Interfaces / QueryClientConfig
- Interfaces / QueryExecuteOptions
- Interfaces / QueryFilters
- Interfaces / QueryObserverBaseResult
- Interfaces / QueryObserverLoadingErrorResult
- Interfaces / QueryObserverLoadingResult
- Interfaces / QueryObserverOptions
- Interfaces / QueryObserverPendingResult
- Interfaces / QueryObserverPlaceholderResult
- Interfaces / QueryObserverRefetchErrorResult
- Interfaces / QueryObserverSuccessResult
- Interfaces / QueryOptions
- Interfaces / QueryState
- Interfaces / RefetchOptions
- Interfaces / RefetchQueryFilters
- Interfaces / Register
- Interfaces / ResetOptions
- Interfaces / ResultOptions
- Interfaces / SetDataOptions
- Interfaces / TimeoutManager
- Types / Accessor
- Types / AnyDataTag
- Types / CreateBaseMutationResult
- Types / CreateBaseQueryOptions
- Types / CreateBaseQueryResult
- Types / CreateInfiniteQueryOptions
- Types / CreateInfiniteQueryResult
- Types / CreateMutateAsyncFunction
- Types / CreateMutateFunction
- Types / CreateMutationOptions
- Types / CreateMutationResult
- Types / CreateQueryOptions
- Types / CreateQueryResult
- Types / DataTag
- Types / DefaultError
- Types / DefaultedInfiniteQueryObserverOptions
- Types / DefaultedQueryObserverOptions
- Types / DefinedCreateBaseQueryResult
- Types / DefinedCreateQueryResult
- Types / DefinedInfiniteQueryObserverResult
- Types / DefinedInitialDataOptions
- Types / DefinedQueryObserverResult
- Types / DistributiveOmit
- Types / EnsureInfiniteQueryDataOptions
- Types / FetchInfiniteQueryOptions
- Types / FetchStatus
- Types / GetNextPageParamFunction
- Types / GetPreviousPageParamFunction
- Types / HydrationBoundary
- Types / InferDataFromTag
- Types / InferErrorFromTag
- Types / InfiniteQueryExecuteOptions
- Types / InfiniteQueryObserverResult
- Types / InitialDataFunction
- Types / ManagedTimerId
- Types / MutateFunction
- Types / MutateFunctionRest
- Types / MutationCacheNotifyEvent
- Types / MutationFunction
- Types / MutationFunctionContext
- Types / MutationKey
- Types / MutationMeta
- Types / MutationObserverResult
- Types / MutationScope
- Types / MutationStateOptions
- Types / MutationStatus
- Types / MutationTypeFromResult
- Types / NetworkMode
- Types / NonUndefinedGuard
- Types / NotifyEventType
- Types / NotifyOnChangeProps
- Types / OmitKeyof
- Types / Override
- Types / PlaceholderDataFunction
- Types / QueriesOptions
- Types / QueriesPlaceholderDataFunction
- Types / QueriesResults
- Types / QueryBooleanOption
- Types / QueryCacheNotifyEvent
- Types / QueryClientProviderProps
- Types / QueryFunction
- Types / QueryFunctionContext
- Types / QueryKey
- Types / QueryKeyHashFunction
- Types / QueryKeyWithDataTag
- Types / QueryMeta
- Types / QueryObserverResult
- Types / QueryPersister
- Types / QueryStatus
- Types / SkipToken
- Types / StaleTime
- Types / StaleTimeFunction
- Types / ThrowOnError
- Types / TimeoutCallback
- Types / TimeoutProvider
- Types / UndefinedInitialDataOptions
- Types / UnsetMarker
- Types / Updater
- Types / WithRequired
- Types / dataTagErrorSymbol
- Types / dataTagSymbol
- Variables / HydrationBoundary
- Variables / dataTagErrorSymbol
- Variables / dataTagSymbol
- Variables / defaultScheduler
- Variables / environmentManager
- Variables / focusManager
- Variables / isServer
- Variables / notifyManager
- Variables / onlineManager
- Variables / skipToken
- Variables / timeoutManager
- Variables / unsetMarker
notifyManager
const notifyManager: object;Defined in: packages/query-core/src/notifyManager.ts:154
Handles scheduling and batching callbacks in TanStack Query.
Type Declaration#
batch#
readonly batch: <T>(callback: () => T) => T;Batches all updates scheduled inside the passed callback. This is mainly used internally to optimize query client updating. Batches can be nested; the queue is only flushed once the outermost batch call finishes. The return value of callback is passed through.
Type Parameters#
T#
T
Parameters#
callback#
() => T
The function to run in the batch.
Returns#
T
The return value of callback.
batchCalls#
readonly batchCalls: <T>(callback: BatchCallsCallback<T>) => BatchCallsCallback<T>;All calls to the wrapped function will be batched.
Type Parameters#
T#
T extends unknown[]
Parameters#
callback#
BatchCallsCallback<T>
The function to wrap.
Returns#
BatchCallsCallback<T>
A function that schedules a call to callback with the given arguments.
schedule#
schedule: (callback: NotifyCallback) => void;Schedules a function to be run on the next batch. By default, the batch is run with a setTimeout, but this can be configured via setScheduler.
Parameters#
callback#
NotifyCallback
Returns#
void
setBatchNotifyFunction#
readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void;Use this method to set a custom function to batch notifications together into a single tick. Framework adapters use this to plug in their own batching primitive, so that a single query update only triggers one re-render instead of one per subscriber.
Parameters#
fn#
BatchNotifyFunction
Receives a function that runs a batch of notifications and must call it.
Returns#
void
Example#
import { notifyManager } from '@tanstack/query-core'
import { batch } from 'solid-js'
notifyManager.setBatchNotifyFunction(batch)setNotifyFunction#
readonly setNotifyFunction: (fn: NotifyFunction) => void;Use this method to set a custom notify function. This can be used to for example wrap notifications with React.act while running tests.
Parameters#
fn#
NotifyFunction
Receives each notification callback and must call it.
Returns#
void
setScheduler#
readonly setScheduler: (fn: ScheduleFunction) => void;Configures a custom callback that schedules when the next batch runs. The default behavior is setTimeout(callback, 0).
Parameters#
fn#
ScheduleFunction
Receives a callback that runs the next batch, and schedules it.
Returns#
void
Example#
import { notifyManager } from '@tanstack/query-core'
// Schedule batches in the next microtask
notifyManager.setScheduler(queueMicrotask)
// Schedule batches before the next frame is rendered
notifyManager.setScheduler(requestAnimationFrame)
// Schedule batches some time in the future
notifyManager.setScheduler((cb) => setTimeout(cb, 10))