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
Describe the bug
Unmounting a mutation cancels the onCompleted subscription, and thus results in logic unexpectedly not executing.
To Reproduce
Render a "loading" indicator in place of a Mutation(onCompleted: () => print('completed'), ...) wrapped button
Expected behavior
I think it would be more intuitive if we handled inflight mutations in the query manager itself. Apollo still uses promises for mutations - maybe we can revive some of the old Future logic for the mutation flow?
The text was updated successfully, but these errors were encountered:
@micimize Yeah, in flight mutations should be handled in the query manager. I think we should revisit the stream cleanup, to check if there are in-flight queries (or mutations) before closing the stream.
@HofmannZ ended up implementing essentially what you're talking about in #130 using a lifecycle enum to track mutations, and waiting to clean them up after side effects.
One major change is that I'm deferring the creation of the observable until runMutation, and forcibly replacing it if the same mutation is run multiple times, replacing callbacks. These changes work for now, but I still feel like the way it hangs together is a bit non-optimal.
With queries, I think we can assume the results won't be used if the component is unmounting, so I think they're fine.
sidebar - I wasn't sure about sticking with Streams for mutations over Futures, but the more I thought about it, there's no reason users shouldn't eventually be able to use the seemingly query-specific directives like @defer in mutations
Describe the bug
Unmounting a mutation cancels the
onCompleted
subscription, and thus results in logic unexpectedly not executing.To Reproduce
Render a "loading" indicator in place of a
Mutation(onCompleted: () => print('completed'), ...)
wrapped buttonExpected behavior
I think it would be more intuitive if we handled inflight mutations in the query manager itself. Apollo still uses promises for mutations - maybe we can revive some of the old
Future
logic for the mutation flow?The text was updated successfully, but these errors were encountered: