Replies: 1 comment 4 replies
-
invalidating via
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
I'm using this library on my app and it's just a game changer. It's very nice to manage server state with this tool !
But I have some trouble since I implement the Infinite Scroll using infinite query.
I will try to explain the use case.
The app can be simplify and compare to a big Todo App.
We can apply some filters to the todo and mark them as 'Done'.
The UI show the list of todos 20 by 20 using the infinite Query
So in the ReactQuery cache it's design with this key:
['todos']
to request Todos without any filters['todo', 'UI']
to request Todos with tagUI
Now the problem
When I open the app it make a request for all todos. So in cache i have
['todos']
Now the user apply a filter, a new request is launch, and now in cache i have :
['todo', 'UI']
['todos']
In the screen the user has the data of only this key :
['todo', 'UI']
Now, the user tag a Todo as
Done
So I call a mutation.
The mutation edit in this key
['todo', 'UI']
the Todo chosen by the user and optimisticly edit the status in it to show the result to the user, and finally, it should invalidate the key['todos']
. Unfortunatly, when the user remove the filters, the page show the data of['todos']
, but the data were not refetch ! So the previous Todo than the user has tag as Done is still not done.I think I missed something somewhere, but I don't know where, any advices ?
Beta Was this translation helpful? Give feedback.
All reactions