Skip to content

Support setQueryData for new queries #109

@tibotiber

Description

@tibotiber

Hello,

I'm realizing that setQueryData only supports updating the cache for a query that has been used previously.

https://github.com/tannerlinsley/react-query/blob/db71fc0d874244da82490a05915d9324c527e9e7/src/index.js#L704-L706

What would you think of enabling it for new queries?

My use-case is that I create a resource in one page, get the resource back from the create mutation, and redirect to another page which fetches the resource. I would like to set the cache for that fetch since I have the data, but I currently am not able to.

Happy to help if feasible.

Thank you.

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