01 · Before and afterThe pattern
// before: refresh failure rolls back a committed change
try { const r = await api.move(id, to); tx.commit(r); await refresh(); }
catch (e) { tx.rollback(); throw e; }
// after: rollback only covers the mutation itself
try { const r = await api.move(id, to); tx.commit(r); }
catch (e) { tx.rollback(); throw e; }
refresh().catch((e) => log("refresh after move failed", e));02 · Run it on your appThe check
If the refresh after a successful save fails, does your UI undo the save or show it as an error?
If the honest answer is no or not sure, this is worth a look before it reaches production.