-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
We merged #3116 for the new invalidationBehavior setting in RTK 2.0, but never actually covered that in the API docs. Needs to be covered in the createApi options.
We do have a docblock with a description here:
redux-toolkit/packages/toolkit/src/query/createApi.ts
Lines 154 to 163 in e848a55
| /** | |
| * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation. | |
| * | |
| * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running. | |
| * If the query provides tags that were invalidated while it ran, it won't be re-fetched. | |
| * - `'delayed'`: Invalidation only happens after all queries and mutations are settled. | |
| * This ensures that queries are always invalidated correctly and automatically "batches" invalidations of concurrent mutations. | |
| * Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely. | |
| */ | |
| invalidationBehavior?: 'delayed' | 'immediately' |
and createApi.mdx already uses a build-time system that can pull docblock descriptions from the code into the Markdown file:
### `tagTypes`
[summary](docblock://query/createApi.ts?token=CreateApiOptions.tagTypes)
[examples](docblock://query/createApi.ts?token=CreateApiOptions.tagTypes)So, we'll want to add another header section for the invalidationBehavior option and include the summary there, as well as possibly add more description or examples.
elramus