Skip to content

Add missing API ref docs for the invalidationBehavior option for createApi #4751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
markerikson opened this issue Dec 4, 2024 · 0 comments · Fixed by #4762
Closed

Add missing API ref docs for the invalidationBehavior option for createApi #4751

markerikson opened this issue Dec 4, 2024 · 0 comments · Fixed by #4762

Comments

@markerikson
Copy link
Collaborator

markerikson commented Dec 4, 2024

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:

/**
* 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant