On unMount the followTask might get cancelled before the saveTask and therefore, upon unMount cancelation the catch is not invoked. In this example, the optimistic update then does not get reverted.
Since saveTask is declared before followTask it should be cancelled first, but probably the order is not reliable enough.
When a task calls another tasks, it might do something like this, perhaps when doing an optimistic update:
On
unMount
thefollowTask
might get cancelled before thesaveTask
and therefore, upon unMount cancelation thecatch
is not invoked. In this example, the optimistic update then does not get reverted.Since
saveTask
is declared beforefollowTask
it should be cancelled first, but probably the order is not reliable enough.Workaround for this particular case:
But it shouldn't be needed.