Closed dizlexik closed 6 months ago
updates.Mutation
is called for optimistic updates as well, so as long as you return an optimistic result it will get invoked even for your optimistic updates 😅 I would love to know what version exactly broke it as we normally ask for a reproduction, saying "no time" is a bit.. disrespectful given that we give our time to you for free as well
I thought it would be helpful to document this issue here so that other users who may be experiencing the same problem can have a place to discuss it, and it seemed reasonable to me to write this up so that any contributors familiar with this area of the code would be aware that there is a defect. I very much appreciate all of the hard work that you and others have put into this great library, but the truth is that I really don't have the time right now to create a reproduction of this, so if it's disrespectful to point out this bug without doing that then I apologize, and please feel free to delete the issue. I'll take a look at it myself when I have more time, and I'll be careful about posting issues here in the future. Thanks for your time, xoxo.
Closing due to inactivity, always open to re-opening this when we have a minimal reproduction that illustrates the problem
Describe the bug
I just upgraded @urql/exchange-graphcache in my project from v6.0.4 to v6.3.3 and it broke some cache invalidation I was doing within an
optimistic
handler. The code is very simple and is along the lines of this example in the documentation:cache.invalidate({ __typename: 'Todo', id: 1 })
. The line has no effect now within theoptimistic
handler, but moving it intoupdates.Mutation
works. This is an okay workaround for now but not ideal. I'd rather this cache invalidation happen immediately when the mutation is executed, like it was before, instead of having to wait for the response. I don't see any changes in the documentation in this area so this feels like a bug to me. Any help would be greatly appreciated, thanks!Reproduction
No time, sorry
Urql version
@urql/exchange-graphcache v6.3.3
Validations