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 are currently migrating our business logic to Jotai and we are seeing an issue where creating a mutation atom and only calling it from inside of a write atom is causing the mutation callbacks to not fire.
Then onSuccess will not fire unless someMutationAtom is mounted somewhere. I believe internally there is a listener attached to the mutation observer while mounted and I would expect that listener to be active while a query is occurring.
I should add that passing options into the atomWithMutation callback are working just fine. However, there are many cases where we want to custom options on a mutation by mutation basis.
The text was updated successfully, but these errors were encountered:
jljorgenson18
changed the title
Mutation option callback are not firing if mutation is not mounted
Mutation option callbacks are not firing if mutation is not mounted
Oct 11, 2024
We are currently migrating our business logic to Jotai and we are seeing an issue where creating a mutation atom and only calling it from inside of a write atom is causing the mutation callbacks to not fire.
If you have atoms like this
Then
onSuccess
will not fire unlesssomeMutationAtom
is mounted somewhere. I believe internally there is a listener attached to the mutation observer while mounted and I would expect that listener to be active while a query is occurring.I should add that passing options into the atomWithMutation callback are working just fine. However, there are many cases where we want to custom options on a mutation by mutation basis.
See https://codesandbox.io/p/sandbox/jotai-react-query-repro-forked-99trmz for an example. If you comment in the mutation hook, it starts working.
The text was updated successfully, but these errors were encountered: