01 · Before and afterThe pattern
Gate a destructive recovery on observed state and a single in-flight guard.
let resetting: Promise<void> | null = null;
syncState$.subscribe(s => {
if (s.status !== 'stuck' || resetting) return; // before: setTimeout(reset, 0 / 5000 / 15000) on every mount
resetting = engine.forceFullResync({ timeoutMs: 30_000 })
.catch(err => log.warn('reset failed', err))
.finally(() => { resetting = null; });
});02 · Run it on your appThe check
Can you list every place your app forces a full resync, and does each one fire only when sync is provably stuck?
If the honest answer is no or not sure, this is worth a look before it reaches production.