Skip to content

Commit 865fe1d

Browse files
committed
fix: reset inactivity timer on user activity during session warning modal
The activity listener now resets the timer whenever the user interacts with the page, even when the session timeout modal is showing. This ensures the modal dismisses and the session extends if the user is active.
1 parent 20984cd commit 865fe1d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/hooks/useSessionTimeout.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ export function useSessionTimeout({
8585
resetTimer();
8686

8787
const handleActivity = () => {
88-
if (!showWarning) {
89-
resetTimer();
90-
}
88+
// Reset timer on any activity, whether modal is showing or not
89+
resetTimer();
9190
};
9291

9392
ACTIVITY_EVENTS.forEach((event) => {
@@ -100,7 +99,7 @@ export function useSessionTimeout({
10099
document.removeEventListener(event, handleActivity);
101100
});
102101
};
103-
}, [resetTimer, clearAllTimers, showWarning]);
102+
}, [resetTimer, clearAllTimers]);
104103

105104
return { showWarning, secondsRemaining, dismissWarning };
106105
}

0 commit comments

Comments
 (0)