Skip to content

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

Closed
@markerikson

Description

@markerikson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions