fix: preserve truthful queue recovery status
CI / lint (pull_request) Successful in 2m35s
CI / build-release (pull_request) Successful in 5s
CI / browser-journey (pull_request) Successful in 1m53s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-17 21:55:00 +00:00
1 parent ce2f04ab6d
commit 5bf0f97df8
4 files changed
+9 -5

No files matched your search

+1 -1
View File
@@ -376,7 +376,7 @@
onStatus: (state, detail = {}) => {
const status = qs('#today-sync-status');
status.textContent = state === 'saved' ? 'Today saved to account.' :
(state === 'recovered' ? `Recovered ${detail.discarded} Today edit${detail.discarded === 1 ? '' : 's'} · discarded ${detail.discarded} unreadable device record${detail.discarded === 1 ? '' : 's'}.` :
(state === 'recovered' ? `Today queue recovered · discarded ${detail.discarded} unreadable device record${detail.discarded === 1 ? '' : 's'}.` :
(state === 'retrying' ? `Today saved on this device · retrying in ${Math.ceil(detail.delayMs / 1000)}s.` :
(state === 'pending' ? 'Today saved on this device · sync pending.' :
(state === 'full' ? 'Another device filled Today · showing its saved plan.' :
+6 -2
View File
@@ -303,8 +303,12 @@ function createTodaySync({ storage, getLogin, fetchJson, onRemoteIds, onRemotePl
cancelRetry();
return !hadConflict;
} catch (error) {
if (pending().length) scheduleRetry(error, ownerKey);
else onStatus?.('error');
const stillPending = pending().length;
if (discardedCount) recoveryNotice = { discarded: discardedCount, until: now() + 5000 };
const recovered = recoveryNotice.until > now() ? recoveryNotice.discarded : 0;
if (stillPending) scheduleRetry(error, ownerKey);
else onStatus?.(recovered ? 'recovered' : 'error', recovered ? { discarded: recovered } : {});
discardedCount = 0;
return false;
}
}