Skip to content

Add a skipToken that resets the query hook if it's been initialized before (e.g. skipOrResetToken) #2411

@kasparkallas

Description

@kasparkallas

I'd like to see an easy way to reset the query to uninitialized without having to re-mount the component.

Example usage:

const accountData = useAccountDataQuery(accountId ? { id: accountId } : skipOrResetToken);

Passing the skipOrResetToken guarantees that there's no data (i.e. stale data) coming from the query.

The use-case arose from the fact that the stale data with just the skipToken can be surprising when you have a user inputted conditional for whether to execute the query or not (e.g. "address", "item name", "username" etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions