Replies: 1 comment
-
Update : So just doing optimistic update without invalidate works. It updates my data and if I come back or refresh my page, data is up to date.. Would be nice to know if I'm doing something wrong or not with
|
Beta Was this translation helpful? Give feedback.
0 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.
-
Hello,
I didn't open a bug because I'm not sure it is ...
Dependencies :
"react": "18.2.0"
"vite": "4.1.1"
"@tanstack/react-query": "4.26.1"
Let me explain what I'm trying to do :
useinfinitequery
hook 🆗useMutation
hook 🆗invalidateQueries
to refetch the dataonSuccess
but it doesn't update...ReactQuery
devtoolsWhen I use the mutation, my request to delete the resource is sent and the invalidateQueries too.. I'm thinking it's happening too fast because if I call
invalidateQueries
inside a setTimeout of 1000ms it's working.Example :
useMutation hook :
Using
deleteFolder
:<button onClick={() => deleteFolder.mutate()}>Delete Folder</button>
If I add the setTimeout, it's working but I don't like this hack..
Is it possible to wait the server ?
Is it normal ?
Do I have to perform optimistic update and not waiting for the server ?
Is
invalidateQueries
needs to be await ? (async / await)🙏🏼 Thank you for your help !
Beta Was this translation helpful? Give feedback.
All reactions