Fix push reminder not showing - remove initial cooldown

The issue was that DEFAULT_STATE set lastInteraction to Date.now(),
which meant the 5-minute cooldown started immediately on first load,
preventing reminders from ever showing.

Changes:
- Set initial lastInteraction to 0 instead of Date.now()
- Don't reset lastInteraction when switching projects (keep cooldown)
- This allows reminders to show immediately after threshold is met

Users may need to clear localStorage key 'push-reminder-state' to
reset if they already have the old state saved.
This commit is contained in:
shakespeare.diy committed 2025-11-11 14:01:46 -06:00
1 parent 66a37ec92c
commit a7164c0292
1 file changed
+2 -2
+2 -2
View File
@@ -16,7 +16,7 @@ interface PushReminderState {
const DEFAULT_STATE: PushReminderState = {
enabled: true,
messagesSinceLastPush: 0,
lastInteraction: Date.now(),
lastInteraction: 0, // Start at 0 so reminders can show immediately
currentProjectId: null,
};
@@ -41,7 +41,7 @@ export function usePushReminder(projectId: string | null) {
...prev,
currentProjectId: projectId,
messagesSinceLastPush: 0,
lastInteraction: Date.now(),
// Don't reset lastInteraction - keep the cooldown across project switches
}));
}
}, [projectId, state.currentProjectId, setState]);