OnSettled return void change in recent update causes error, how to solve?
We used to return a context on the onSettled to reset it to null (see screenshot) after the onSettled return type change to
void | Promise<void>it started to throw an error. How can we achieve the same result now?
4 Replies
rare-sapphireOP•6mo ago
and

rare-sapphireOP•6mo ago
we used this pattern to determine which component has the loading state and I believe the context remains after the mutation is finished, hence we wanted to ensure that it was set back to null.
Maybe we're all wrong about this... but hopefully someone has a better solution at hand that can be shared.
like-gold•6mo ago
what's it supposed to do?
onSettled isn't supposed to return anything, except that you can return a promise which we await. But returning an object doesn't do anything?
we're not storing that or anything
what do you think returning { couponLegacyId: null } from onSettled would do? you can just delete the code 🤷♂️rare-sapphireOP•6mo ago
Yeah that's what I ended up doing.. I was under the wrong impression you could change the context value still on the return