Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/framework/react/guides/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For deeper examples on hydration + prefetching (including code splitting), see t

For advanced server rendering patterns, such as streaming, Server Components and the new Next.js app router, see the [Advanced Server Rendering guide](./advanced-ssr.md).

If you just want to see some code, you can skip ahead to the [Full Next.js pages router example](#full-nextjs-pages-router-example) or the [Full Remix example](#full-remix-example) below.
If you just want to see some code, you can skip ahead to the [Full Next.js pages router example](#full-next-js-pages-router-example) or the [Full Remix example](#full-remix-example) below.

## Server Rendering & React Query

Expand Down
6 changes: 3 additions & 3 deletions docs/reference/MutationCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const mutationCache = new MutationCache({

Its available methods are:

- [`getAll`](#mutationcachegetall)
- [`subscribe`](#mutationcachesubscribe)
- [`clear`](#mutationcacheclear)
- [`getAll`](#mutationcache-getall)
- [`subscribe`](#mutationcache-subscribe)
- [`clear`](#mutationcache-clear)

**Options**

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/QueryCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const query = queryCache.find({ queryKey: ['posts'] })

Its available methods are:

- [`queryCache.find`](#querycachefind)
- [`queryCache.findAll`](#querycachefindall)
- [`queryCache.subscribe`](#querycachesubscribe)
- [`queryCache.clear`](#querycacheclear)
- [`queryCache.find`](#querycache-find)
- [`queryCache.findAll`](#querycache-findall)
- [`queryCache.subscribe`](#querycache-subscribe)
- [`queryCache.clear`](#querycache-clear)
- [Further reading](#further-reading)

**Options**
Expand Down
88 changes: 44 additions & 44 deletions docs/reference/QueryClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ await queryClient.prefetchQuery({ queryKey: ['posts'], queryFn: fetchPosts })

Its available methods are:

- [`queryClient.fetchQuery`](#queryclientfetchquery)
- [`queryClient.fetchInfiniteQuery`](#queryclientfetchinfinitequery)
- [`queryClient.prefetchQuery`](#queryclientprefetchquery)
- [`queryClient.prefetchInfiniteQuery`](#queryclientprefetchinfinitequery)
- [`queryClient.getQueryData`](#queryclientgetquerydata)
- [`queryClient.ensureQueryData`](#queryclientensurequerydata)
- [`queryClient.ensureInfiniteQueryData`](#queryclientensureinfinitequerydata)
- [`queryClient.getQueriesData`](#queryclientgetqueriesdata)
- [`queryClient.setQueryData`](#queryclientsetquerydata)
- [`queryClient.getQueryState`](#queryclientgetquerystate)
- [`queryClient.setQueriesData`](#queryclientsetqueriesdata)
- [`queryClient.invalidateQueries`](#queryclientinvalidatequeries)
- [`queryClient.refetchQueries`](#queryclientrefetchqueries)
- [`queryClient.cancelQueries`](#queryclientcancelqueries)
- [`queryClient.removeQueries`](#queryclientremovequeries)
- [`queryClient.resetQueries`](#queryclientresetqueries)
- [`queryClient.isFetching`](#queryclientisfetching)
- [`queryClient.isMutating`](#queryclientismutating)
- [`queryClient.getDefaultOptions`](#queryclientgetdefaultoptions)
- [`queryClient.setDefaultOptions`](#queryclientsetdefaultoptions)
- [`queryClient.getQueryDefaults`](#queryclientgetquerydefaults)
- [`queryClient.setQueryDefaults`](#queryclientsetquerydefaults)
- [`queryClient.getMutationDefaults`](#queryclientgetmutationdefaults)
- [`queryClient.setMutationDefaults`](#queryclientsetmutationdefaults)
- [`queryClient.getQueryCache`](#queryclientgetquerycache)
- [`queryClient.getMutationCache`](#queryclientgetmutationcache)
- [`queryClient.clear`](#queryclientclear)
- [`queryClient.resumePausedMutations`](#queryclientresumepausedmutations)
- [`queryClient.fetchQuery`](#queryclient-fetchquery)
- [`queryClient.fetchInfiniteQuery`](#queryclient-fetchinfinitequery)
- [`queryClient.prefetchQuery`](#queryclient-prefetchquery)
- [`queryClient.prefetchInfiniteQuery`](#queryclient-prefetchinfinitequery)
- [`queryClient.getQueryData`](#queryclient-getquerydata)
- [`queryClient.ensureQueryData`](#queryclient-ensurequerydata)
- [`queryClient.ensureInfiniteQueryData`](#queryclient-ensureinfinitequerydata)
- [`queryClient.getQueriesData`](#queryclient-getqueriesdata)
- [`queryClient.setQueryData`](#queryclient-setquerydata)
- [`queryClient.getQueryState`](#queryclient-getquerystate)
- [`queryClient.setQueriesData`](#queryclient-setqueriesdata)
- [`queryClient.invalidateQueries`](#queryclient-invalidatequeries)
- [`queryClient.refetchQueries`](#queryclient-refetchqueries)
- [`queryClient.cancelQueries`](#queryclient-cancelqueries)
- [`queryClient.removeQueries`](#queryclient-removequeries)
- [`queryClient.resetQueries`](#queryclient-resetqueries)
- [`queryClient.isFetching`](#queryclient-isfetching)
- [`queryClient.isMutating`](#queryclient-ismutating)
- [`queryClient.getDefaultOptions`](#queryclient-getdefaultoptions)
- [`queryClient.setDefaultOptions`](#queryclient-setdefaultoptions)
- [`queryClient.getQueryDefaults`](#queryclient-getquerydefaults)
- [`queryClient.setQueryDefaults`](#queryclient-setquerydefaults)
- [`queryClient.getMutationDefaults`](#queryclient-getmutationdefaults)
- [`queryClient.setMutationDefaults`](#queryclient-setmutationdefaults)
- [`queryClient.getQueryCache`](#queryclient-getquerycache)
- [`queryClient.getMutationCache`](#queryclient-getmutationcache)
- [`queryClient.clear`](#queryclient-clear)
- [`queryClient.resumePausedMutations`](#queryclient-resumepausedmutations)

**Options**

Expand Down Expand Up @@ -116,7 +116,7 @@ try {

**Options**

The options for `fetchInfiniteQuery` are exactly the same as those of [`fetchQuery`](#queryclientfetchquery).
The options for `fetchInfiniteQuery` are exactly the same as those of [`fetchQuery`](#queryclient-fetchquery).

**Returns**

Expand All @@ -138,7 +138,7 @@ await queryClient.prefetchQuery({ queryKey })

**Options**

The options for `prefetchQuery` are exactly the same as those of [`fetchQuery`](#queryclientfetchquery).
The options for `prefetchQuery` are exactly the same as those of [`fetchQuery`](#queryclient-fetchquery).

**Returns**

Expand All @@ -155,7 +155,7 @@ await queryClient.prefetchInfiniteQuery({ queryKey, queryFn })

**Options**

The options for `prefetchInfiniteQuery` are exactly the same as those of [`fetchQuery`](#queryclientfetchquery).
The options for `prefetchInfiniteQuery` are exactly the same as those of [`fetchQuery`](#queryclient-fetchquery).

**Returns**

Expand Down Expand Up @@ -189,7 +189,7 @@ const data = await queryClient.ensureQueryData({ queryKey, queryFn })

**Options**

- the same options as [`fetchQuery`](#queryclientfetchquery)
- the same options as [`fetchQuery`](#queryclient-fetchquery)
- `revalidateIfStale: boolean`
- Optional
- Defaults to `false`
Expand All @@ -214,7 +214,7 @@ const data = await queryClient.ensureInfiniteQueryData({

**Options**

- the same options as [`fetchInfiniteQuery`](#queryclientfetchinfinitequery)
- the same options as [`fetchInfiniteQuery`](#queryclient-fetchinfinitequery)
- `revalidateIfStale: boolean`
- Optional
- Defaults to `false`
Expand Down Expand Up @@ -250,7 +250,7 @@ This distinction is more a "convenience" for ts devs that know which structure w

## `queryClient.setQueryData`

`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook within the default `gcTime`, the query will be garbage collected. If the default `gcTime` has not been configured, it defaults to 5 minutes.** To update multiple queries at once and match query keys partially, you need to use [`queryClient.setQueriesData`](#queryclientsetqueriesdata) instead.
`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook within the default `gcTime`, the query will be garbage collected. If the default `gcTime` has not been configured, it defaults to 5 minutes.** To update multiple queries at once and match query keys partially, you need to use [`queryClient.setQueriesData`](#queryclient-setqueriesdata) instead.

> The difference between using `setQueryData` and `fetchQuery` is that `setQueryData` is sync and assumes that you already synchronously have the data available. If you need to fetch the data asynchronously, it's suggested that you either refetch the query key or use `fetchQuery` to handle the asynchronous fetch.

Expand Down Expand Up @@ -302,7 +302,7 @@ console.log(state.dataUpdatedAt)

## `queryClient.setQueriesData`

`setQueriesData` is a synchronous function that can be used to immediately update cached data of multiple queries by using filter function or partially matching the query key. Only queries that match the passed queryKey or queryFilter will be updated - no new cache entries will be created. Under the hood, [`setQueryData`](#queryclientsetquerydata) is called for each existing query.
`setQueriesData` is a synchronous function that can be used to immediately update cached data of multiple queries by using filter function or partially matching the query key. Only queries that match the passed queryKey or queryFilter will be updated - no new cache entries will be created. Under the hood, [`setQueryData`](#queryclient-setquerydata) is called for each existing query.

```tsx
queryClient.setQueriesData(filters, updater)
Expand All @@ -313,15 +313,15 @@ queryClient.setQueriesData(filters, updater)
- `filters: QueryFilters`: [Query Filters](../framework/react/guides/filters.md#query-filters)
- if a filter is passed, queryKeys matching the filter will be updated
- `updater: TQueryFnData | (oldData: TQueryFnData | undefined) => TQueryFnData`
- the [setQueryData](#queryclientsetquerydata) updater function or new data, will be called for each matching queryKey
- the [setQueryData](#queryclient-setquerydata) updater function or new data, will be called for each matching queryKey

## `queryClient.invalidateQueries`

The `invalidateQueries` method can be used to invalidate and refetch single or multiple queries in the cache based on their query keys or any other functionally accessible property/state of the query. By default, all matching queries are immediately marked as invalid and active queries are refetched in the background.

- If you **do not want active queries to refetch**, and simply be marked as invalid, you can use the `refetchType: 'none'` option.
- If you **want inactive queries to refetch** as well, use the `refetchType: 'all'` option
- For refetching, [queryClient.refetchQueries](#queryclientrefetchqueries) is called.
- For refetching, [queryClient.refetchQueries](#queryclient-refetchqueries) is called.

```tsx
await queryClient.invalidateQueries(
Expand Down Expand Up @@ -354,8 +354,8 @@ await queryClient.invalidateQueries(

**Notes**

- Unlike [`refetchQueries`](#queryclientrefetchqueries), `invalidateQueries` marks matching queries as invalidated and then refetches `active` queries (unless otherwise specified with the `refetchType` option).
- Unlike [`removeQueries`](#queryclientremovequeries), `invalidateQueries` keeps matching queries in the cache.
- Unlike [`refetchQueries`](#queryclient-refetchqueries), `invalidateQueries` marks matching queries as invalidated and then refetches `active` queries (unless otherwise specified with the `refetchType` option).
- Unlike [`removeQueries`](#queryclient-removequeries), `invalidateQueries` keeps matching queries in the cache.

## `queryClient.refetchQueries`

Expand Down Expand Up @@ -400,7 +400,7 @@ This function returns a promise that will resolve when all of the queries are do

- Queries that are "disabled" because they only have disabled Observers will never be refetched.
- Queries that are "static" because they only have Observers with a Static StaleTime will never be refetched.
- Unlike [`invalidateQueries`](#queryclientinvalidatequeries), `refetchQueries` refetches all matching queries.
- Unlike [`invalidateQueries`](#queryclient-invalidatequeries), `refetchQueries` refetches all matching queries.

## `queryClient.cancelQueries`

Expand Down Expand Up @@ -442,7 +442,7 @@ This method does not return anything

**Notes**

- Unlike [`invalidateQueries`](#queryclientinvalidatequeries) or [`refetchQueries`](#queryclientrefetchqueries), `removeQueries` removes matching queries from the cache instead of refetching them.
- Unlike [`invalidateQueries`](#queryclient-invalidatequeries) or [`refetchQueries`](#queryclient-refetchqueries), `removeQueries` removes matching queries from the cache instead of refetching them.

## `queryClient.resetQueries`

Expand Down Expand Up @@ -543,7 +543,7 @@ const defaultOptions = queryClient.getQueryDefaults(['posts'])
```

> Note that if several query defaults match the given query key, they will be merged together based on the order of registration.
> See [`setQueryDefaults`](#queryclientsetquerydefaults).
> See [`setQueryDefaults`](#queryclient-setquerydefaults).

## `queryClient.setQueryDefaults`

Expand All @@ -562,7 +562,7 @@ function Component() {
- `queryKey: QueryKey`: [Query Keys](../framework/react/guides/query-keys.md)
- `options: QueryOptions`

> As stated in [`getQueryDefaults`](#queryclientgetquerydefaults), the order of registration of query defaults does matter.
> As stated in [`getQueryDefaults`](#queryclient-getquerydefaults), the order of registration of query defaults does matter.
> Since the matching defaults are merged by `getQueryDefaults`, the registration should be made in the following order: from the **most generic key** to the **least generic one** .
> This way, more specific defaults will override more generic defaults.

Expand Down Expand Up @@ -591,7 +591,7 @@ function Component() {
- `mutationKey: unknown[]`
- `options: MutationOptions`

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

## `queryClient.getQueryCache`

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/environmentManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Use this manager to override server detection globally for runtimes that are not

Its available methods are:

- [`isServer`](#environmentmanagerisserver)
- [`setIsServer`](#environmentmanagersetisserver)
- [`isServer`](#environmentmanager-isserver)
- [`setIsServer`](#environmentmanager-setisserver)

## `environmentManager.isServer`

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/focusManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ It can be used to change the default event listeners or to manually change the f

Its available methods are:

- [`setEventListener`](#focusmanagerseteventlistener)
- [`subscribe`](#focusmanagersubscribe)
- [`setFocused`](#focusmanagersetfocused)
- [`isFocused`](#focusmanagerisfocused)
- [`setEventListener`](#focusmanager-seteventlistener)
- [`subscribe`](#focusmanager-subscribe)
- [`setFocused`](#focusmanager-setfocused)
- [`isFocused`](#focusmanager-isfocused)

## `focusManager.setEventListener`

Expand Down
12 changes: 6 additions & 6 deletions docs/reference/notifyManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ The `notifyManager` handles scheduling and batching callbacks in TanStack Query.

It exposes the following methods:

- [batch](#notifymanagerbatch)
- [batchCalls](#notifymanagerbatchcalls)
- [schedule](#notifymanagerschedule)
- [setNotifyFunction](#notifymanagersetnotifyfunction)
- [setBatchNotifyFunction](#notifymanagersetbatchnotifyfunction)
- [setScheduler](#notifymanagersetscheduler)
- [batch](#notifymanager-batch)
- [batchCalls](#notifymanager-batchcalls)
- [schedule](#notifymanager-schedule)
- [setNotifyFunction](#notifymanager-setnotifyfunction)
- [setBatchNotifyFunction](#notifymanager-setbatchnotifyfunction)
- [setScheduler](#notifymanager-setscheduler)

## `notifyManager.batch`

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/onlineManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The `OnlineManager` manages the online state within TanStack Query. It can be us

Its available methods are:

- [`setEventListener`](#onlinemanagerseteventlistener)
- [`subscribe`](#onlinemanagersubscribe)
- [`setOnline`](#onlinemanagersetonline)
- [`isOnline`](#onlinemanagerisonline)
- [`setEventListener`](#onlinemanager-seteventlistener)
- [`subscribe`](#onlinemanager-subscribe)
- [`setOnline`](#onlinemanager-setonline)
- [`isOnline`](#onlinemanager-isonline)

## `onlineManager.setEventListener`

Expand Down
10 changes: 5 additions & 5 deletions docs/reference/timeoutManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ By default, TimeoutManager uses the global `setTimeout` and `setInterval`, but i

Its available methods are:

- [`timeoutManager.setTimeoutProvider`](#timeoutmanagersettimeoutprovider)
- [`timeoutManager.setTimeoutProvider`](#timeoutmanager-settimeoutprovider)
- [`TimeoutProvider`](#timeoutprovider)
- [`timeoutManager.setTimeout`](#timeoutmanagersettimeout)
- [`timeoutManager.clearTimeout`](#timeoutmanagercleartimeout)
- [`timeoutManager.setInterval`](#timeoutmanagersetinterval)
- [`timeoutManager.clearInterval`](#timeoutmanagerclearinterval)
- [`timeoutManager.setTimeout`](#timeoutmanager-settimeout)
- [`timeoutManager.clearTimeout`](#timeoutmanager-cleartimeout)
- [`timeoutManager.setInterval`](#timeoutmanager-setinterval)
- [`timeoutManager.clearInterval`](#timeoutmanager-clearinterval)

## `timeoutManager.setTimeoutProvider`

Expand Down