Conversation
When an alert is dismissed, `alertState` becomes null but the Snackbar keeps rendering its content during the exit transition. The fallback for that case was an empty alert with severity "error", so every closing notification briefly flashed red. Remember the last non-null alert and keep rendering it until the next one arrives. The fallback severity is now "info". Adds a test that re-renders with a null alert and checks the closing alert keeps its message and severity. Fixes cdisc-org#215
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #215
When a notification closes,
alertStatebecomesnull, but the Snackbar keeps rendering its content during the exit transition. Fornull,GeneralAlertrendered an empty alert with severity"error", so every closing notification flashed red.During Export rules YAML this happens between the status updates. The Snackbar's 5-second auto-hide timer starts when it opens and is not reset when the message changes, so a long download closes the notification. It flashes red while closing, and the next status update opens it again.
Changes
"info"instead of"error"as the fallback severity.openis stillalertState !== null, so notifications open and close at the same times as before.Testing
src/components/GeneralAlert/GeneralAlert.test.tsxwith 2 tests. The second re-renders with anullalert while the Snackbar is still closing and checks that the alert keeps the text "Saved 3 Rules" and the success style. With the fix reverted, it fails because the text is empty.tsc --noEmitpasses, and ESLint passes for the changed files.src/App.test.tsxalready fails onmainbecause Jest does not transform the ESM build ofreact-monaco-editor. This PR does not change that.The "Build and Deploy Preview" check uses repository secrets, so it is expected to fail for a pull request from a fork.