Flush pending state save immediately when tab backgrounds/closes
Settings changes (like the reminder time) were saved via a 1.5s debounce; closing or switching away from the tab right after an edit could kill that pending save before it reached the server, silently losing the change. Now flushed on visibilitychange instead of relying on the timer alone. Also confirmed via a live server-side test (bypassing the client entirely) that the reminder loop itself fires correctly — trimmed the verbose per-tick debug log added for that test, kept the one for an actual match.
This commit is contained in:
1 parent
5a7ce13ca2
commit
10fa150d09
2 files changed
+11
No files matched your search
@@ -116,6 +116,7 @@ setInterval(() => {
|
||||
const rid = effectiveRoutineId(S, now.date);
|
||||
if (!rid) continue; // rest day — nothing planned
|
||||
const routine = (S.routines || []).find(r => r.id === rid);
|
||||
console.log('reminder firing', user.id, rid);
|
||||
user.lastReminder = now.date;
|
||||
saveDb();
|
||||
sendPush(user.id, {
|
||||
|
||||
Reference in new issue
Block a user