Skip to content

How to use cache value immediately after mutation? #9273

Answered by alexander-ye
alexander-ye asked this question in Q&A
Discussion options

You must be logged in to vote

Edit:
Use mutateAsync.

Prev answer:
I'm silly. You can pass a callback function to the wrapper function.

(I am a little concerned about stale closures and whether you need to pass the mutation function into the mutation key array, but the function I'm writing "lives" outside of React so doesn't rely on state variables—hence the desire to get runtime values)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alexander-ye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant