You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We manage this app with OpenSearch so we have a delay and no response from the backend. That's why I do Optimistic UI. Is it best to use onMutate or onSuccess in this case ?
I would like to know if there are any recommendations or pattern to rewrite the hook with optional callbacks (onError, onSuccess, ...) ? Because I will need to export it in your ui library and some apps will use it without need to make Optimistic UI
It is best to have the hook directly in the modal but how to get back information to make Optimistic UI ? (I also considered not using React Query, but simple async calls and then I was looking at useMutationState but a lot of refacto would be happening... and I would have to manage data with queryClient directly)
It there any interest in using mutate / mutateAsync options ? I did not really catch the benefit in using them :
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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 have the below custom hook that returns
useMutation
.FYI: searchParams comes from zustand store, because we have a lot of state management outside data scope
This hook is passed as props to an external modal that performs some async calls
I typed updateResource like this :
and it is used like this :
I have some questions :
We manage this app with OpenSearch so we have a delay and no response from the backend. That's why I do Optimistic UI. Is it best to use
onMutate
oronSuccess
in this case ?I would like to know if there are any recommendations or pattern to rewrite the hook with optional callbacks (onError, onSuccess, ...) ? Because I will need to export it in your ui library and some apps will use it without need to make Optimistic UI
It is best to have the hook directly in the modal but how to get back information to make Optimistic UI ? (I also considered not using React Query, but simple async calls and then I was looking at
useMutationState
but a lot of refacto would be happening... and I would have to manage data with queryClient directly)It there any interest in using
mutate / mutateAsync
options ? I did not really catch the benefit in using them :That's it! Any idea, any help is welcome :)
Beta Was this translation helpful? Give feedback.
All reactions