Dan Mercer
Dan Mercer3y ago

Tell if mutations are pending

Is there a way to tell if mutations are pending? I noticed the Convex browser client seems to register a beforeunload handler to warn the user if there are mutations pending, and it'd be really cool if I could show an indicator in my UI as well
3 Replies
ballingt
ballingt3y ago
You can get close to this do this by watching the promises returned by the mutations: once those resolve, that info is saved
ian
ian3y ago
e.g.
onClick={async () => {
setLoading(true);
await myMutation(...);
setLoading(false);
}}
onClick={async () => {
setLoading(true);
await myMutation(...);
setLoading(false);
}}
Dan Mercer
Dan MercerOP3y ago
Ooo that makes sense! Thanks!

Did you find this page helpful?