Skip to content

Commit 6d9d69e

Browse files
committed
Fix up broken docsl inks
1 parent 0aded32 commit 6d9d69e

File tree

10 files changed

+52
-35
lines changed

10 files changed

+52
-35
lines changed

docs/api/rtk-query/createApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ export const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({
114114

115115
[summary](docblock://query/endpointDefinitions.ts?token=MutationExtraOptions.invalidates)
116116

117-
- `onStart`, `onError` and `onSuccess` _(optional)_ - Available to both [queries](../concepts/queries) and [mutations](../concepts/mutations)
118-
- Can be used in `mutations` for [optimistic updates](../concepts/optimistic-updates).
117+
- `onStart`, `onError` and `onSuccess` _(optional)_ - Available to both [queries](../../usage/rtk-query/queries.md) and [mutations](../../usage/rtk-query/mutations.md)
118+
- Can be used in `mutations` for [optimistic updates](../../usage/rtk-query/optimistic-updates.md).
119119
- ```ts title="Mutation lifecycle signatures"
120120
function onStart(
121121
arg: QueryArg,

docs/api/rtk-query/created-api/cache-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ hide_title: true
77

88
# API Slices: Cache Management Utilities
99

10-
The API slice object includes cache management utilities that are used for implementing [optimistic updates](../../concepts/optimistic-updates.md). These are included in a `util` field inside the slice object.
10+
The API slice object includes cache management utilities that are used for implementing [optimistic updates](../../../usage/rtk-query/optimistic-updates.md). These are included in a `util` field inside the slice object.
1111

1212
### `updateQueryResult`
1313

docs/api/rtk-query/created-api/code-splitting.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ hide_title: true
77

88
# API Slices: Code Splitting and Generation
99

10-
Each API slice allows [additional endpoint definitions to be injected at runtime](../../concepts/code-splitting.md) after the initial API slice has been defined. This can be beneficial for apps that may have _many_ endpoints.
10+
Each API slice allows [additional endpoint definitions to be injected at runtime](../../../usage/rtk-query/code-splitting.md) after the initial API slice has been defined. This can be beneficial for apps that may have _many_ endpoints.
1111

12-
The individual API slice endpoint definitions can also be split across multiple files. This is primarily useful for working with API slices that were [code-generated from an API schema file](../../concepts/code-generation.md), allowing you to add additional custom behavior and configuration to a set of automatically-generated endpoint definitions.
12+
The individual API slice endpoint definitions can also be split across multiple files. This is primarily useful for working with API slices that were [code-generated from an API schema file](../../../usage/rtk-query/code-generation.md), allowing you to add additional custom behavior and configuration to a set of automatically-generated endpoint definitions.
1313

1414
Each API slice object has `injectEndpoints` and `enhanceEndpoints` functions to support these use cases.
1515

@@ -18,11 +18,12 @@ Each API slice object has `injectEndpoints` and `enhanceEndpoints` functions to
1818
#### Signature
1919

2020
```ts
21-
const injectEndpoints = (endpointOptions: InjectedEndpointOptions) => EnhancedApiSlice;
21+
const injectEndpoints = (endpointOptions: InjectedEndpointOptions) =>
22+
EnhancedApiSlice
2223

2324
interface InjectedEndpointOptions {
24-
endpoints: (build: EndpointBuilder) => NewEndpointDefinitions;
25-
overrideExisting?: boolean;
25+
endpoints: (build: EndpointBuilder) => NewEndpointDefinitions
26+
overrideExisting?: boolean
2627
}
2728
```
2829

@@ -41,11 +42,12 @@ This method is primarily useful for code splitting and hot reloading.
4142
#### Signature
4243

4344
```ts
44-
const enhanceEndpoints = (endpointOptions: EnhanceEndpointsOptions) => EnhancedApiSlice;
45+
const enhanceEndpoints = (endpointOptions: EnhanceEndpointsOptions) =>
46+
EnhancedApiSlice
4547

4648
interface EnhanceEndpointsOptions {
47-
addTagTypes?: readonly string[];
48-
endpoints?: Record<string, Partial<EndpointDefinition>>;
49+
addTagTypes?: readonly string[]
50+
endpoints?: Record<string, Partial<EndpointDefinition>>
4951
}
5052
```
5153

docs/api/rtk-query/created-api/endpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ A Redux thunk action creator that you can dispatch to trigger data fetch queries
8585
React Hooks users will most likely never need to use these directly, as the hooks automatically dispatch these actions as needed.
8686

8787
:::note Usage of actions outside of React Hooks
88-
When dispatching an action creator, you're responsible for storing a reference to the promise it returns in the event that you want to update that specific subscription. Also, you have to manually unsubscribe once your component unmounts. To get an idea of what that entails, see the [Svelte Example](../../../examples/svelte) or the [React Class Components Example](../../../examples/react-class-components)
88+
When dispatching an action creator, you're responsible for storing a reference to the promise it returns in the event that you want to update that specific subscription. Also, you have to manually unsubscribe once your component unmounts. To get an idea of what that entails, see the [Svelte Example](../../../usage/rtk-query/examples.md#svelte) or the [React Class Components Example](../../../usage/rtk-query/examples.md#react-class-components)
8989
:::
9090

9191
## `select`

docs/api/rtk-query/created-api/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ The API slice object will have an `endpoints` field inside. This section maps th
7979
8080
## Code Splitting and Generation
8181
82-
Each API slice allows [additional endpoint definitions to be injected at runtime](../../concepts/code-splitting.md) after the initial API slice has been defined. This can be beneficial for apps that may have _many_ endpoints.
82+
Each API slice allows [additional endpoint definitions to be injected at runtime](../../../usage/rtk-query/code-splitting.md) after the initial API slice has been defined. This can be beneficial for apps that may have _many_ endpoints.
8383
84-
The individual API slice endpoint definitions can also be split across multiple files. This is primarily useful for working with API slices that were [code-generated from an API schema file](../../concepts/code-generation.md), allowing you to add additional custom behavior and configuration to a set of automatically-generated endpoint definitions.
84+
The individual API slice endpoint definitions can also be split across multiple files. This is primarily useful for working with API slices that were [code-generated from an API schema file](../../../usage/rtk-query/code-generation.md), allowing you to add additional custom behavior and configuration to a set of automatically-generated endpoint definitions.
8585
8686
Each API slice object has `injectEndpoints` and `enhanceEndpoints` functions to support these use cases.
8787

docs/api/rtk-query/fetchBaseQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Promise<{
4040

4141
### Using `fetchBaseQuery`
4242

43-
To use it, import it when you are [creating an API service definition](../introduction/getting-started#create-an-api-service).
43+
To use it, import it when you are [creating an API service definition](../../tutorials/rtk-query#create-an-api-service).
4444

4545
```ts title="src/services/pokemon.ts"
4646
// Or from '@reduxjs/toolkit/query/react'

docs/usage/rtk-query/optimistic-updates.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,38 @@ const api = createApi({
1919
baseQuery,
2020
tagTypes: ['Post'],
2121
endpoints: (build) => ({
22-
getPost: build.query<Post, string>({ query: (id) => `post/${id}`, providesTags: ['Post'] }),
23-
updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>, { undoPost: Patch[] }>({
24-
query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),
22+
getPost: build.query<Post, string>({
23+
query: (id) => `post/${id}`,
24+
providesTags: ['Post'],
25+
}),
26+
updatePost: build.mutation<
27+
void,
28+
Pick<Post, 'id'> & Partial<Post>,
29+
{ undoPost: Patch[] }
30+
>({
31+
query: ({ id, ...patch }) => ({
32+
url: `post/${id}`,
33+
method: 'PATCH',
34+
body: patch,
35+
}),
2536
onStart({ id, ...patch }, { dispatch, context }) {
2637
// When we start the request, just immediately update the cache
2738
context.undoPost = dispatch(
2839
api.util.updateQueryResult('getPost', id, (draft) => {
29-
Object.assign(draft, patch);
40+
Object.assign(draft, patch)
3041
})
31-
).inversePatches;
42+
).inversePatches
3243
},
3344
onError({ id }, { dispatch, context }) {
3445
// If there is an error, roll it back
35-
dispatch(api.util.patchQueryResult('getPost', id, context.undoPost));
46+
dispatch(api.util.patchQueryResult('getPost', id, context.undoPost))
3647
},
3748
invalidatesTags: ['Post'],
3849
}),
3950
}),
40-
});
51+
})
4152
```
4253

4354
### Example
4455

45-
[View Example](../examples/react-optimistic-updates)
56+
[View Example](./examples#react-optimistic-updates)

docs/usage/rtk-query/polling.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,35 @@ hide_title: true
1010
Polling gives you the ability to have a 'real-time' effect by causing a query to run at a specified interval. To enable polling for a query, pass a `pollingInterval` to the `useQuery` hook or action creator with an interval in milliseconds:
1111

1212
```ts title="src/Pokemon.tsx"
13-
import * as React from 'react';
14-
import { useGetPokemonByNameQuery } from './services/pokemon';
13+
import * as React from 'react'
14+
import { useGetPokemonByNameQuery } from './services/pokemon'
1515

1616
export const Pokemon = ({ name }: { name: string }) => {
1717
// Automatically refetch every 3s
18-
const { data, status, error, refetch } = useGetPokemonByNameQuery(name, { pollingInterval: 3000 });
18+
const { data, status, error, refetch } = useGetPokemonByNameQuery(name, {
19+
pollingInterval: 3000,
20+
})
1921

20-
return <div>{data}</div>;
21-
};
22+
return <div>{data}</div>
23+
}
2224
```
2325

2426
In an action creator without React Hooks:
2527

2628
```js
2729
const { data, status, error, refetch } = store.dispatch(
28-
endpoints.getCountById.initiate(id, { subscriptionOptions: { pollingInterval: 3000 } })
29-
);
30+
endpoints.getCountById.initiate(id, {
31+
subscriptionOptions: { pollingInterval: 3000 },
32+
})
33+
)
3034
```
3135

3236
:::note Usage without React Hooks
33-
If you use polling without the convenience of React Hooks, you will need to manually call `updateSubscriptionOptions` on the promise ref to update the interval. This approach varies by framework but is possible everywhere. See the [Svelte Example](../examples/svelte) for one possibility.
37+
If you use polling without the convenience of React Hooks, you will need to manually call `updateSubscriptionOptions` on the promise ref to update the interval. This approach varies by framework but is possible everywhere. See the [Svelte Example](./examples#svelte) for one possibility.
3438
:::
3539

3640
```js
37-
queryRef.updateSubscriptionOptions({ pollingInterval: 0 });
41+
queryRef.updateSubscriptionOptions({ pollingInterval: 0 })
3842
```
3943

4044
### Example

src/query/createApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface CreateApiOptions<
4949
*/
5050
baseQuery: BaseQuery
5151
/**
52-
* An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining an tag type, you will be able to [provide](../concepts/mutations#provides) them with `provides` and [invalidate](../concepts/mutations#advanced-mutations-with-revalidation) them with `invalidates` when configuring [endpoints](#endpoints).
52+
* An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining an tag type, you will be able to [provide](../../usage/rtk-query/mutations#provides) them with `provides` and [invalidate](../../usage/rtk-query/mutations#advanced-mutations-with-revalidation) them with `invalidates` when configuring [endpoints](#endpoints).
5353
*/
5454
tagTypes?: readonly TagTypes[]
5555
/** @deprecated renamed to `tagTypes` */
@@ -86,7 +86,7 @@ export interface CreateApiOptions<
8686
*/
8787
serializeQueryArgs?: SerializeQueryArgs<BaseQueryArg<BaseQuery>>
8888
/**
89-
* Endpoints are just a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are two basic endpoint types: [`query`](../concepts/queries) and [`mutation`](../concepts/mutations).
89+
* Endpoints are just a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are two basic endpoint types: [`query`](../../usage/rtk-query/queries) and [`mutation`](../../usage/rtk-query/mutations).
9090
*/
9191
endpoints(
9292
build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>

src/query/endpointDefinitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ interface MutationExtraOptions<
247247
> {
248248
type: DefinitionType.mutation
249249
/**
250-
* - Used by `mutations` for [cache invalidation](../concepts/mutations#advanced-mutations-with-revalidation) purposes.
250+
* - Used by `mutations` for [cache invalidation](../../usage/rtk-query/mutations.md#advanced-mutations-with-revalidation) purposes.
251251
* - Expects the same shapes as `provides`.
252252
*/
253253
invalidatesTags?: ResultDescription<

0 commit comments

Comments
 (0)