Skip to content

Keep the last alert visible while the notification closes - #302

Open
danbom wants to merge 1 commit into
cdisc-org:mainfrom
danbom:fix/alert-error-flash-on-close
Open

danbom wants to merge 1 commit into
cdisc-org:mainfrom
danbom:fix/alert-error-flash-on-close

Conversation

@danbom

@danbom danbom commented Oct 1, 2026

Copy link
Copy Markdown

Fixes #215

When a notification closes, alertState becomes null, but the Snackbar keeps rendering its content during the exit transition. For null, GeneralAlert rendered 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

  • Remember the last alert and keep showing it while the Snackbar closes.
  • Use "info" instead of "error" as the fallback severity.
  • open is still alertState !== null, so notifications open and close at the same times as before.

Testing

  • Added src/components/GeneralAlert/GeneralAlert.test.tsx with 2 tests. The second re-renders with a null alert 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 --noEmit passes, and ESLint passes for the changed files.
  • src/App.test.tsx already fails on main because Jest does not transform the ESM build of react-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.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status notification timing issue

1 participant