Skip to content

Commit

Permalink
docs: fix broken internal links in the query docs (v4) (#7398)
Browse files Browse the repository at this point in the history
* Fixing links: round 1

* Fix more links

* Fix the rest of the links in the React docs

* Fix some broken links for the vue docs

* Fix the broken links in the svelte docs
  • Loading branch information
fulopkovacs committed May 12, 2024
1 parent 84f3ef1 commit 3f22c3d
Show file tree
Hide file tree
Showing 44 changed files with 112 additions and 112 deletions.
4 changes: 2 additions & 2 deletions docs/framework/react/guides/caching.md
Expand Up @@ -3,7 +3,7 @@ id: caching
title: Caching Examples
---

> Please thoroughly read the [Important Defaults](./guides/important-defaults) before reading this guide
> Please thoroughly read the [Important Defaults](../../../../framework/react/guides/important-defaults) before reading this guide
## Basic Example

Expand All @@ -23,7 +23,7 @@ Let's assume we are using the default `cacheTime` of **5 minutes** and the defau
- A second instance of `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` mounts elsewhere.
- Since the cache already has data for the `['todos']` key from the first query, that data is immediately returned from the cache.
- The new instance triggers a new network request using its query function.
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](./reference/useQuery) are updated (including `isFetching`, `isLoading`, and other related values) because they have the same query key.
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](../../../../framework/react/reference/useQuery) are updated (including `isFetching`, `isLoading`, and other related values) because they have the same query key.
- When the request completes successfully, the cache's data under the `['todos']` key is updated with the new data, and both instances are updated with the new data.
- Both instances of the `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` query are unmounted and no longer in use.
- Since there are no more active instances of this query, a cache timeout is set using `cacheTime` to delete and garbage collect the query (defaults to **5 minutes**).
Expand Down
6 changes: 3 additions & 3 deletions docs/framework/react/guides/important-defaults.md
Expand Up @@ -15,7 +15,7 @@ Out of the box, TanStack Query is configured with **aggressive but sane** defaul
- The network is reconnected
- The query is optionally configured with a refetch interval

If you see a refetch that you are not expecting, it is likely because you just focused the window and TanStack Query is doing a [`refetchOnWindowFocus`](./guides/window-focus-refetching). During development, this will probably be triggered more frequently, especially because focusing between the Browser DevTools and your app will also cause a fetch, so be aware of that.
If you see a refetch that you are not expecting, it is likely because you just focused the window and TanStack Query is doing a [`refetchOnWindowFocus`](../window-focus-refetching). During development, this will probably be triggered more frequently, especially because focusing between the Browser DevTools and your app will also cause a fetch, so be aware of that.

> To change this functionality, you can use options like `refetchOnMount`, `refetchOnWindowFocus`, `refetchOnReconnect` and `refetchInterval`.
Expand All @@ -38,7 +38,7 @@ If you see a refetch that you are not expecting, it is likely because you just f

Have a look at the following articles from our Community Resources for further explanations of the defaults:

- [Practical React Query](./community/tkdodos-blog#1-practical-react-query)
- [React Query as a State Manager](./community/tkdodos-blog#10-react-query-as-a-state-manager)
- [Practical React Query](../../../../framework/react/community/tkdodos-blog#1-practical-react-query)
- [React Query as a State Manager](../../../../framework/react/community/tkdodos-blog#10-react-query-as-a-state-manager)

[//]: # 'Materials'
2 changes: 1 addition & 1 deletion docs/framework/react/guides/infinite-queries.md
Expand Up @@ -138,7 +138,7 @@ refetch({ refetchPage: (page, index) => index === 0 })

[//]: # 'Example2'

You can also pass this function as part of the 2nd argument (`queryFilters`) to [queryClient.refetchQueries](./reference/QueryClient#queryclientrefetchqueries), [queryClient.invalidateQueries](./reference/QueryClient#queryclientinvalidatequeries) or [queryClient.resetQueries](./reference/QueryClient#queryclientresetqueries).
You can also pass this function as part of the 2nd argument (`queryFilters`) to [queryClient.refetchQueries](../../../../reference/QueryClient#queryclientrefetchqueries), [queryClient.invalidateQueries](../../../../reference/QueryClient#queryclientinvalidatequeries) or [queryClient.resetQueries](../../../../reference/QueryClient#queryclientresetqueries).

**Signature**

Expand Down
6 changes: 3 additions & 3 deletions docs/framework/react/guides/initial-query-data.md
Expand Up @@ -8,8 +8,8 @@ There are many ways to supply initial data for a query to the cache before you n
- Declaratively:
- Provide `initialData` to a query to prepopulate its cache if empty
- Imperatively:
- [Prefetch the data using `queryClient.prefetchQuery`](./guides/prefetching)
- [Manually place the data into the cache using `queryClient.setQueryData`](./guides/prefetching)
- [Prefetch the data using `queryClient.prefetchQuery`](../prefetching)
- [Manually place the data into the cache using `queryClient.setQueryData`](../prefetching)

## Using `initialData` to prepopulate a query

Expand Down Expand Up @@ -170,6 +170,6 @@ const result = useQuery({

## Further reading

For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](./community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).
For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](../../community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).

[//]: # 'Materials'
Expand Up @@ -36,4 +36,4 @@ const mutation = useMutation({

[//]: # 'Example2'

You can wire up your invalidations to happen using any of the callbacks available in the [`useMutation` hook](./guides/mutations)
You can wire up your invalidations to happen using any of the callbacks available in the [`useMutation` hook](../../../../framework/react/guides/mutations)
4 changes: 2 additions & 2 deletions docs/framework/react/guides/migrating-to-react-query-3.md
Expand Up @@ -103,8 +103,8 @@ try {

Together, these provide the same experience as before, but with added control to choose which component trees you want to reset. For more information, see:

- [QueryErrorResetBoundary](./reference/QueryErrorResetBoundary)
- [useQueryErrorResetBoundary](./reference/useQueryErrorResetBoundary)
- [QueryErrorResetBoundary](../../reference/QueryErrorResetBoundary)
- [useQueryErrorResetBoundary](../../reference/useQueryErrorResetBoundary)

### `QueryCache.getQuery()` has been replaced by `QueryCache.find()`.

Expand Down
10 changes: 5 additions & 5 deletions docs/framework/react/guides/mutations.md
Expand Up @@ -59,7 +59,7 @@ Beyond those primary states, more information is available depending on the stat

In the example above, you also saw that you can pass variables to your mutations function by calling the `mutate` function with a **single variable or object**.

Even with just variables, mutations aren't all that special, but when used with the `onSuccess` option, the [Query Client's `invalidateQueries` method](./reference/QueryClient#queryclientinvalidatequeries) and the [Query Client's `setQueryData` method](./reference/QueryClient#queryclientsetquerydata), mutations become a very powerful tool.
Even with just variables, mutations aren't all that special, but when used with the `onSuccess` option, the [Query Client's `invalidateQueries` method](../../../../reference/QueryClient#queryclientinvalidatequeries) and the [Query Client's `setQueryData` method](../../../../reference/QueryClient#queryclientsetquerydata), mutations become a very powerful tool.

[//]: # 'Info1'

Expand Down Expand Up @@ -136,7 +136,7 @@ const CreateTodo = () => {

## Mutation Side Effects

`useMutation` comes with some helper options that allow quick and easy side-effects at any stage during the mutation lifecycle. These come in handy for both [invalidating and refetching queries after mutations](./guides/invalidations-from-mutations) and even [optimistic updates](./guides/optimistic-updates)
`useMutation` comes with some helper options that allow quick and easy side-effects at any stage during the mutation lifecycle. These come in handy for both [invalidating and refetching queries after mutations](../invalidations-from-mutations) and even [optimistic updates](../optimistic-updates)

[//]: # 'Example4'

Expand Down Expand Up @@ -340,7 +340,7 @@ queryClient.resumePausedMutations()

### Persisting Offline mutations

If you persist offline mutations with the [persistQueryClient plugin](./plugins/persistQueryClient), mutations cannot be resumed when the page is reloaded unless you provide a default mutation function.
If you persist offline mutations with the [persistQueryClient plugin](../../../../framework/react/plugins/persistQueryClient), mutations cannot be resumed when the page is reloaded unless you provide a default mutation function.

This is a technical limitation. When persisting to an external storage, only the state of mutations is persisted, as functions cannot be serialized. After hydration, the component that triggers the mutation might not be mounted, so calling `resumePausedMutations` might yield an error: `No mutationFn found`.

Expand Down Expand Up @@ -383,13 +383,13 @@ export default function App() {

[//]: # 'Example11'

We also have an extensive [offline example](./examples/offline) that covers both queries and mutations.
We also have an extensive [offline example](../../examples/offline) that covers both queries and mutations.

[//]: # 'Materials'

## Further reading

For more information about mutations, have a look at [#12: Mastering Mutations in React Query](./community/tkdodos-blog#12-mastering-mutations-in-react-query) from
For more information about mutations, have a look at [#12: Mastering Mutations in React Query](../../community/tkdodos-blog#12-mastering-mutations-in-react-query) from
the Community Resources.

[//]: # 'Materials'
8 changes: 4 additions & 4 deletions docs/framework/react/guides/network-mode.md
Expand Up @@ -3,13 +3,13 @@ id: network-mode
title: Network Mode
---

TanStack Query provides three different network modes to distinguish how [Queries](./guides/queries) and [Mutations](./guides/mutations) should behave if you have no network connection. This mode can be set for each Query / Mutation individually, or globally via the query / mutation defaults.
TanStack Query provides three different network modes to distinguish how [Queries](../../../../framework/react/guides/queries) and [Mutations](../../../../framework/react/guides/mutations) should behave if you have no network connection. This mode can be set for each Query / Mutation individually, or globally via the query / mutation defaults.

Since TanStack Query is most often used for data fetching in combination with data fetching libraries, the default network mode is [online](#network-mode-online).

## Network Mode: online

In this mode, Queries and Mutations will not fire unless you have network connection. This is the default mode. If a fetch is initiated for a query, it will always stay in the `state` (`loading`, `error`, `success`) it is in if the fetch cannot be made because there is no network connection. However, a [fetchStatus](./guides/queries#fetchstatus) is exposed additionally. This can be either:
In this mode, Queries and Mutations will not fire unless you have network connection. This is the default mode. If a fetch is initiated for a query, it will always stay in the `state` (`loading`, `error`, `success`) it is in if the fetch cannot be made because there is no network connection. However, a [fetchStatus](../../../../framework/react/guides/queries#fetchstatus) is exposed additionally. This can be either:

- `fetching`: The `queryFn` is really executing - a request is in-flight.
- `paused`: The query is not executing - it is `paused` until you have connection again
Expand All @@ -19,7 +19,7 @@ The flags `isFetching` and `isPaused` are derived from this state and exposed fo

> Keep in mind that it might not be enough to check for `loading` state to show a loading spinner. Queries can be in `state: 'loading'`, but `fetchStatus: 'paused'` if they are mounting for the first time, and you have no network connection.
If a query runs because you are online, but you go offline while the fetch is still happening, TanStack Query will also pause the retry mechanism. Paused queries will then continue to run once you re-gain network connection. This is independent of `refetchOnReconnect` (which also defaults to `true` in this mode), because it is not a `refetch`, but rather a `continue`. If the query has been [cancelled](./guides/query-cancellation) in the meantime, it will not continue.
If a query runs because you are online, but you go offline while the fetch is still happening, TanStack Query will also pause the retry mechanism. Paused queries will then continue to run once you re-gain network connection. This is independent of `refetchOnReconnect` (which also defaults to `true` in this mode), because it is not a `refetch`, but rather a `continue`. If the query has been [cancelled](../../../../framework/react/guides/query-cancellation) in the meantime, it will not continue.

## Network Mode: always

Expand All @@ -37,7 +37,7 @@ In those situations, the first fetch might succeed because it comes from an offl

## Devtools

The [TanStack Query Devtools](./devtools) will show Queries in a `paused` state if they would be fetching, but there is no network connection. There is also a toggle button to _Mock offline behavior_. Please note that this button will _not_ actually mess with your network connection (you can do that in the browser devtools), but it will set the [OnlineManager](./reference/onlineManager) in an offline state.
The [TanStack Query Devtools](../../../../framework/react/devtools) will show Queries in a `paused` state if they would be fetching, but there is no network connection. There is also a toggle button to _Mock offline behavior_. Please note that this button will _not_ actually mess with your network connection (you can do that in the browser devtools), but it will set the [OnlineManager](../../../../reference/onlineManager) in an offline state.

## Signature

Expand Down
4 changes: 2 additions & 2 deletions docs/framework/react/guides/placeholder-query-data.md
Expand Up @@ -14,7 +14,7 @@ There are a few ways to supply placeholder data for a query to the cache before
- Declaratively:
- Provide `placeholderData` to a query to prepopulate its cache if empty
- Imperatively:
- [Prefetch or fetch the data using `queryClient` and the `placeholderData` option](./guides/prefetching)
- [Prefetch or fetch the data using `queryClient` and the `placeholderData` option](../prefetching)

## Placeholder Data as a Value

Expand Down Expand Up @@ -80,6 +80,6 @@ function Todo({ blogPostId }) {

## Further reading

For a comparison between `Placeholder Data` and `Initial Data`, have a look at the [Community Resources](./community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).
For a comparison between `Placeholder Data` and `Initial Data`, have a look at the [Community Resources](../..//community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).

[//]: # 'Materials'
4 changes: 2 additions & 2 deletions docs/framework/react/guides/prefetching.md
Expand Up @@ -25,7 +25,7 @@ const prefetchTodos = async () => {

## Manually Priming a Query

Alternatively, if you already have the data for your query synchronously available, you don't need to prefetch it. You can just use the [Query Client's `setQueryData` method](./reference/QueryClient#queryclientsetquerydata) to directly add or update a query's cached result by key.
Alternatively, if you already have the data for your query synchronously available, you don't need to prefetch it. You can just use the [Query Client's `setQueryData` method](../../../..//reference/QueryClient#queryclientsetquerydata) to directly add or update a query's cached result by key.

[//]: # 'Example2'

Expand All @@ -38,6 +38,6 @@ queryClient.setQueryData(['todos'], todos)

## Further reading

For a deep-dive on how to get data into your Query Cache before you fetch, have a look at [#17: Seeding the Query Cache](./community/tkdodos-blog#17-seeding-the-query-cache) from the Community Resources.
For a deep-dive on how to get data into your Query Cache before you fetch, have a look at [#17: Seeding the Query Cache](../..//community/tkdodos-blog#17-seeding-the-query-cache) from the Community Resources.

[//]: # 'Materials'
6 changes: 3 additions & 3 deletions docs/framework/react/guides/queries.md
Expand Up @@ -5,7 +5,7 @@ title: Queries

## Query Basics

A query is a declarative dependency on an asynchronous source of data that is tied to a **unique key**. A query can be used with any Promise based method (including GET and POST methods) to fetch data from a server. If your method modifies data on the server, we recommend using [Mutations](./guides/mutations) instead.
A query is a declarative dependency on an asynchronous source of data that is tied to a **unique key**. A query can be used with any Promise based method (including GET and POST methods) to fetch data from a server. If your method modifies data on the server, we recommend using [Mutations](../mutations) instead.

To subscribe to a query in your components or custom hooks, call the `useQuery` hook with at least:

Expand Down Expand Up @@ -121,7 +121,7 @@ TypeScript will also narrow the type of `data` correctly if you've checked for `
In addition to the `status` field and the `result` object, you will also get an additional `fetchStatus` property with the following options:

- `fetchStatus === 'fetching'` - The query is currently fetching.
- `fetchStatus === 'paused'` - The query wanted to fetch, but it is paused. Read more about this in the [Network Mode](./guides/network-mode) guide.
- `fetchStatus === 'paused'` - The query wanted to fetch, but it is paused. Read more about this in the [Network Mode](../network-mode) guide.
- `fetchStatus === 'idle'` - The query is not doing anything at the moment.

### Why two different states?
Expand All @@ -140,6 +140,6 @@ So keep in mind that a query can be in `loading` state without actually fetching

## Further Reading

For an alternative way of performing status checks, have a look at the [Community Resources](./community/tkdodos-blog#4-status-checks-in-react-query).
For an alternative way of performing status checks, have a look at the [Community Resources](../../../../framework/react/community/tkdodos-blog#4-status-checks-in-react-query).

[//]: # 'Materials'
6 changes: 3 additions & 3 deletions docs/framework/react/guides/query-functions.md
Expand Up @@ -99,12 +99,12 @@ function fetchTodoList({ queryKey }) {

The `QueryFunctionContext` is the object passed to each query function. It consists of:

- `queryKey: QueryKey`: [Query Keys](./guides/query-keys)
- `queryKey: QueryKey`: [Query Keys](../query-keys)
- `pageParam?: unknown`
- only for [Infinite Queries](./guides/infinite-queries)
- only for [Infinite Queries](../infinite-queries)
- the page parameter used to fetch the current page
- `signal?: AbortSignal`
- [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) instance provided by TanStack Query
- Can be used for [Query Cancellation](./guides/query-cancellation)
- Can be used for [Query Cancellation](../query-cancellation)
- `meta: Record<string, unknown> | undefined`
- an optional field you can fill with additional information about your query
2 changes: 1 addition & 1 deletion docs/framework/react/guides/query-invalidation.md
Expand Up @@ -25,7 +25,7 @@ When a query is invalidated with `invalidateQueries`, two things happen:

## Query Matching with `invalidateQueries`

When using APIs like `invalidateQueries` and `removeQueries` (and others that support partial query matching), you can match multiple queries by their prefix, or get really specific and match an exact query. For information on the types of filters you can use, please see [Query Filters](./guides/filters#query-filters).
When using APIs like `invalidateQueries` and `removeQueries` (and others that support partial query matching), you can match multiple queries by their prefix, or get really specific and match an exact query. For information on the types of filters you can use, please see [Query Filters](../../../../framework/react/guides/filters#query-filters).

In this example, we can use the `todos` prefix to invalidate any queries that start with `todos` in their query key:

Expand Down

0 comments on commit 3f22c3d

Please sign in to comment.