-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggestion: Handle session expiration gracefully #526
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c2cff93
Return 403 for api endpoints instead of redirecting.
cmaddox5 b5d9316
Stop interval and show modal when API fetches fail.
cmaddox5 eca65d0
Created new ErrorModal component.
cmaddox5 0193c3b
Only show modal on 403.
cmaddox5 d225f0d
Tests.
cmaddox5 8f4ecd1
Fix lint issues.
cmaddox5 9c32425
Fix client tests.
cmaddox5 1482da4
Merge branch 'main' into cm/handle-session-end
cmaddox5 1b6c9fd
Check current and previous path.
cmaddox5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.modal.error-modal { | ||
color: $text-primary; | ||
.modal-dialog { | ||
margin-top: 362px; | ||
} | ||
|
||
.modal-content { | ||
background-color: $cool-gray-20; | ||
|
||
.modal-header { | ||
border-bottom: none; | ||
|
||
.btn-close:hover { | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
.modal-footer { | ||
background-color: $cool-gray-20; | ||
border-top: none; | ||
height: 62px; | ||
padding: 0 12px 0 0; | ||
|
||
.btn { | ||
height: 38px; | ||
} | ||
|
||
.error-modal__refresh-button { | ||
background-color: $button-primary; | ||
color: $button-secondary; | ||
} | ||
|
||
.error-modal__cancel-button { | ||
background-color: $cool-gray-20; | ||
color: #c1e4ff; | ||
border: transparent; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from "react"; | ||
import { Button, Modal } from "react-bootstrap"; | ||
|
||
interface ErrorModalProps { | ||
title: string; | ||
showErrorModal: boolean; | ||
onHide: () => void; | ||
errorMessage: string; | ||
confirmButtonLabel: string; | ||
onConfirm: () => void; | ||
} | ||
|
||
const ErrorModal = ({ | ||
title, | ||
showErrorModal, | ||
onHide, | ||
errorMessage, | ||
confirmButtonLabel, | ||
onConfirm, | ||
}: ErrorModalProps) => { | ||
return ( | ||
<Modal | ||
show={showErrorModal} | ||
className="error-modal" | ||
backdrop="static" | ||
onHide={onHide} | ||
> | ||
<Modal.Header closeButton closeVariant="white"> | ||
{title && <Modal.Title>{title}</Modal.Title>} | ||
</Modal.Header> | ||
<Modal.Body>{errorMessage}</Modal.Body> | ||
<Modal.Footer> | ||
<Button onClick={onHide} className="error-modal__cancel-button"> | ||
Cancel | ||
</Button> | ||
<Button className="error-modal__refresh-button" onClick={onConfirm}> | ||
{confirmButtonLabel} | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ErrorModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we'd only show this modal if, specifically, a background alerts request fails. How is the experience if some other kind of "foreground" request fails? Should we try to integrate this into all instances where we fetch data from the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this task was already kind of scope creep-y, I focused specifically on what I knew to be the problem we see in Sentry.
You do raise a good point though. We've had a habit of assuming a request will be successful so we unintentionally fail silently in some areas. For example, I hardcoded a 500 for the
Associate with alert
page and the only indicator that something went wrong is that the table is empty. Because this would be a bigger task, I'll get it added to the backlog for us to talk about in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you end up writing this task? (sorry for letting this review drop off)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wrote it up here.