Skip to content

Commit 3358c13

Browse files
committed
Fix Parameters headers
1 parent b71222d commit 3358c13

File tree

1 file changed

+47
-40
lines changed

1 file changed

+47
-40
lines changed

docs/rtk-query/api/created-api/api-slice-utils.mdx

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ interface PatchCollection {
4242
}
4343
```
4444

45-
- **Parameters**
46-
- `endpointName`: a string matching an existing endpoint name
47-
- `arg`: an argument matching that used for a previous query call, used to determine which cached dataset needs to be updated
48-
- `updateRecipe`: an Immer `produce` callback that can apply changes to the cached state
49-
- `updateProvided`: a boolean indicating whether the endpoint's provided tags should be re-calculated based on the updated cache. Defaults to `false`.
45+
#### Parameters
46+
47+
- `endpointName`: a string matching an existing endpoint name
48+
- `arg`: an argument matching that used for a previous query call, used to determine which cached dataset needs to be updated
49+
- `updateRecipe`: an Immer `produce` callback that can apply changes to the cached state
50+
- `updateProvided`: a boolean indicating whether the endpoint's provided tags should be re-calculated based on the updated cache. Defaults to `false`.
5051

5152
#### Description
5253

@@ -123,10 +124,11 @@ const upsertQueryData = <T>(endpointName: string, arg: any, newEntryData: T) =>
123124
ThunkAction<Promise<CacheEntry<T>>, PartialState, any, UnknownAction>
124125
```
125126

126-
- **Parameters**
127-
- `endpointName`: a string matching an existing endpoint name
128-
- `arg`: an argument matching that used for a previous query call, used to determine which cached dataset needs to be updated
129-
- `newEntryValue`: the value to be written into the corresponding cache entry's `data` field
127+
#### Parameters
128+
129+
- `endpointName`: a string matching an existing endpoint name
130+
- `arg`: an argument matching that used for a previous query call, used to determine which cached dataset needs to be updated
131+
- `newEntryValue`: the value to be written into the corresponding cache entry's `data` field
130132

131133
#### Description
132134

@@ -161,11 +163,12 @@ const patchQueryData = (
161163
) => ThunkAction<void, PartialState, any, UnknownAction>;
162164
```
163165

164-
- **Parameters**
165-
- `endpointName`: a string matching an existing endpoint name
166-
- `arg`: a cache key, used to determine which cached dataset needs to be updated
167-
- `patches`: an array of patches (or inverse patches) to apply to cached state. These would typically be obtained from the result of dispatching [`updateQueryData`](#updatequerydata)
168-
- `updateProvided`: a boolean indicating whether the endpoint's provided tags should be re-calculated based on the updated cache. Defaults to `false`.
166+
#### Parameters
167+
168+
- `endpointName`: a string matching an existing endpoint name
169+
- `arg`: a cache key, used to determine which cached dataset needs to be updated
170+
- `patches`: an array of patches (or inverse patches) to apply to cached state. These would typically be obtained from the result of dispatching [`updateQueryData`](#updatequerydata)
171+
- `updateProvided`: a boolean indicating whether the endpoint's provided tags should be re-calculated based on the updated cache. Defaults to `false`.
169172

170173
#### Description
171174

@@ -220,11 +223,12 @@ const upsertQueryEntries = (entries: NormalizedQueryUpsertEntry[]) =>
220223
PayloadAction<NormalizedQueryUpsertEntry[]>
221224
```
222225

223-
- **Parameters**
224-
- `entries`: an array of objects that contain the data needed to upsert individual cache entries:
225-
- `endpointName`: the name of the endpoint, such as `"getPokemon"`
226-
- `arg`: the full query key argument needed to identify this cache entry, such as `"pikachu"` (same as you would pass to a `useQuery` hook or `api.endpoints.someEndpoint.select()`)
227-
- `value`: the data to be upserted into this cache entry, exactly as formatted.
226+
#### Parameters
227+
228+
- `entries`: an array of objects that contain the data needed to upsert individual cache entries:
229+
- `endpointName`: the name of the endpoint, such as `"getPokemon"`
230+
- `arg`: the full query key argument needed to identify this cache entry, such as `"pikachu"` (same as you would pass to a `useQuery` hook or `api.endpoints.someEndpoint.select()`)
231+
- `value`: the data to be upserted into this cache entry, exactly as formatted.
228232

229233
#### Description
230234

@@ -259,7 +263,7 @@ const api = createApi({
259263

260264
// Pre-fill the individual post entries with the results
261265
// from the list endpoint query
262-
const entries = dispatch(
266+
dispatch(
263267
api.util.upsertQueryEntries(
264268
posts.map((post) => ({
265269
endpointName: 'getPost',
@@ -290,13 +294,13 @@ const prefetch = (endpointName: string, arg: any, options: PrefetchOptions) =>
290294
ThunkAction<void, any, any, UnknownAction>
291295
```
292296

293-
- **Parameters**
297+
#### Parameters
294298

295-
- `endpointName`: a string matching an existing endpoint name
296-
- `args`: a cache key, used to determine which cached dataset needs to be updated
297-
- `options`: options to determine whether the request should be sent for a given situation:
298-
- `ifOlderThan`: if specified, only runs the query if the difference between `new Date()` and the last`fulfilledTimeStamp` is greater than the given value (in seconds)
299-
- `force`: if `true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.
299+
- `endpointName`: a string matching an existing endpoint name
300+
- `args`: a cache key, used to determine which cached dataset needs to be updated
301+
- `options`: options to determine whether the request should be sent for a given situation:
302+
- `ifOlderThan`: if specified, only runs the query if the difference between `new Date()` and the last`fulfilledTimeStamp` is greater than the given value (in seconds)
303+
- `force`: if `true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.
300304

301305
#### Description
302306

@@ -327,12 +331,13 @@ function selectInvalidatedBy(
327331
}>
328332
```
329333

330-
- **Parameters**
331-
- `state`: the root state
332-
- `tags`: a readonly array of invalidated tags, where the provided `TagDescription` is one of the strings provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api. e.g.
333-
- `[TagType]`
334-
- `[{ type: TagType }]`
335-
- `[{ type: TagType, id: number | string }]`
334+
#### Parameters
335+
336+
- `state`: the root state
337+
- `tags`: a readonly array of invalidated tags, where the provided `TagDescription` is one of the strings provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api. e.g.
338+
- `[TagType]`
339+
- `[{ type: TagType }]`
340+
- `[{ type: TagType, id: number | string }]`
336341

337342
#### Description
338343

@@ -373,11 +378,12 @@ const invalidateTags = (
373378
})
374379
```
375380

376-
- **Parameters**
377-
- `tags`: an array of tags to be invalidated, where the provided `TagType` is one of the strings provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api. e.g.
378-
- `[TagType]`
379-
- `[{ type: TagType }]`
380-
- `[{ type: TagType, id: number | string }]`
381+
#### Parameters
382+
383+
- `tags`: an array of tags to be invalidated, where the provided `TagType` is one of the strings provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api. e.g.
384+
- `[TagType]`
385+
- `[{ type: TagType }]`
386+
- `[{ type: TagType, id: number | string }]`
381387

382388
#### Description
383389

@@ -411,9 +417,10 @@ function selectCachedArgsForQuery(
411417
): Array<QueryArg>
412418
```
413419

414-
- **Parameters**
415-
- `state`: the root state
416-
- `queryName`: a string matching an existing query endpoint name
420+
#### Parameters
421+
422+
- `state`: the root state
423+
- `queryName`: a string matching an existing query endpoint name
417424

418425
#### Description
419426

0 commit comments

Comments
 (0)