SessionRenewal: Rework to probe server to warn about session expiration instead of using heuristic #2377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-on to #2370 and #2366.
Who is this PR for?
educators
What problem does this PR fix?
There were some user reports of being signed out unexpectedly, and in investigating and in looking at Rollbar errors related to
.slice
in parsing dates, this looks like it's coming from users interacting with the server (eg, to save a note) after the session has expired. In that case, it means the educators loses what they just typed in.What does this PR do?
Reworks
<SessionRenewal />
. The core loop is probing the server to see if the user is still signed in. This is with a new/educators/probe
endpoint that skips the normal Devise Timeoutable behavior of keeping the session alive. This endpoint returns how much time is left in the session, and then<SessionRenewal />
shows an expiration notice if it's within the warning window. Renewing the session makes the same request to the server as before.This works better than the previous approach because it avoids UI-side heuristics, and just checks with the server. If the session has already expired, the UI redirects to close the page, since any data from interactions would be lost anyway. The expiration message should make it clear to users this would happen beforehand, and this PR changes the background color to a warning orange instead of blue.
This revises the Rollbar instrumentation and keeps it in place, so we can verify this is working as expected.
Checklists
Which features or pages does this PR touch?
Does this PR use tests to help verify we can deploy these changes quickly and confidently?