invalidateQueries not mutating the key I'm passing to #2820
Replies: 2 comments 3 replies
-
Updated with a Sandbox pseudocode |
Beta Was this translation helpful? Give feedback.
-
I don't see anything wrong in that sandbox. I forked it and added the react-query-devtools: https://codesandbox.io/s/jovial-faraday-dkrbd?file=/src/index.js you can see that when you click on an item on the right side, after the mutation is done, the my guess is that in the example, you're not seeing anything new being added to the list because you're just fetching from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey people!
UPDATE: sandbox example
I'm a bit new to react-query, using it for the first time on my project and I was following the series from TKDodo and now I have a scenario using the
invalidateQueries
which I have built after reading this post of him.Unfortunately I'm having trouble to mutate one key. It's not mutating. I have posted it on the post too, but I think it will be better to post it here. So, here it is:
So I have built my mutation:
And here is how I call it:
and my PUT request works fine, but my mutation never happens (and I went into onSuccess with the debugger) but as far as I saw, I can just see one query key there, but not the one I'm trying to mutate 'portfolio-overview'.
And here is how my portfolio-overview query looks:
basically the logic is -> I'm inside another component which I search for the "peers" and after clicking on it, it's added to the portfolio, which then maps all peers and display all of them in a list, and that's what I'm trying here, to mutate this list after adding a new peer to it.
Beta Was this translation helpful? Give feedback.
All reactions