Closed maximilianoertel closed 2 months ago
Visit the preview URL for this PR (updated for commit 8de203a):
https://roar-staging--pr733-fix-241-session-time-hk3rg038.web.app
(expires Thu, 22 Aug 2024 14:44:30 GMT)
π₯ via Firebase Hosting GitHub Action π
Sign: 2631e9c58fd0104ecbfddd72a62245ddac467460
Project | roar-dashboard-e2e |
Status | Passed |
Commit | 8de203a474 |
Started | Aug 15, 2024 2:44 PM |
Ended | Aug 15, 2024 2:48 PM |
Duration | 03:59 π‘ |
OS | Linux Ubuntu - |
Browser | Edge 127 |
View run in Cypress Cloud β‘οΈ
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud
Great solution, I have one question. When I tried in production (using the PR link) I noticed that after the 15 min it took me to this page:
Is this the correct behavior? Or should It take you to the signing page?
Great solution, I have one question. When I tried in production (using the PR link) I noticed that after the 15 min it took me to this page: [β¦] Is this the correct behavior? Or should It take you to the signing page?
Thanks for catching this @Emily-ejag! Turns out there was a bit of an oversight here from my side β should be working as expected now
This pull request was deployed and Sentry observed the following issues:
checkConsent(src/pages/HomeParticipant)
View IssueDid you find this useful? React with a π or π
Proposed changes
This PR fixes the faulty behaviour of the existing session idle detection timer, initially implemented using the
useIdle
composable.The issues previously reported in the corresponding ticket were primarily caused by how browsers treat inactive tabs. More precisely, when a tab becomes inactives, browsers throttle JS execution, directly impact the timer set by
useIdle
. To circumvent this,useIdle
supports the use of visible change event listeners. Unfortunately, when a user returns to the tab after being active on another site for a while, theuseIdle
timer treats the visible change as activity and resets the idle timer immediately.To avoid these issues, this PR disables the visibility change listener and manually implements corresponding event listeners. Simultaneously, we store an internal last active timestamp when the user leaves the active tab to allow us to calculate the true idle time upon the user's return and trigger the desired business logic.
In order to facilitate development and testing, the timer can be configured using two environment variables:
VITE_AUTH_SESSION_TIMEOUT_IDLE_THRESHOLD
The duration in ms until we consider a user to be idle, defaults to 15min.VITE_AUTH_SESSION_TIMEOUT_COUNTDOWN_DURATION
The duration of the countdown displayed in the dialog, defaults to 60 seconds.Whilst previously only implemented on the Homepage, the session timer is now implemented at the root of the web application to ensure the timer runs on all pages.
Docs are updated in PR yeatmanlab/roar-docs/pull/14
Types of changes
Checklist
Justification of missing checklist items
n/a
Further comments
Additionally, this PR introduces these (minor out-of-scope) changes (that, if required, can be moved to a separate PR):
.nvmrc
file to facilitate local development practices.editorconfig
file to enhance development experienceFinally, it might be worth considering adding a small alert / card within the sign-in page to inform a user they have been signed-out due to inactivity.
Fixes yeatmanlab/roar/issues/241