feat(toasts): auto-dismiss Success/Info after 5s; keep Warning/Error sticky (MAPPS-312) #343

Merged
YousifShkara merged 1 commit from fix/MAPPS-312-toast-auto-dismiss into main 2026-06-25 11:02:07 +02:00
Owner

QA report: a normal session piled up 5+ Success toasts in the
bottom-right that all required manual close. The global
push_toast had no timer at all; every variant stuck until the
user clicked X.

Fix:

  • Toast gains auto_dismiss_ms: Option<u32>. None = sticky
    (the existing behaviour); Some(ms) = scheduled dismiss.
  • push_toast and push_toast_with_title set the default per
    AlertType: Success / Info -> Some(5_000), Warning / Error ->
    None. A real failure cannot be missed by a user who tabbed away.
  • ToastContainer now iterates into a new internal ToastRow
    component keyed by toast id. The split is required so the timer
    effect scopes to a single id - a use_effect in the container
    would fire once per list change and either spawn duplicates or
    schedule against the wrong row.
  • ToastRow::use_effect runs once on mount and spawns a
    gloo_timers::future::TimeoutFuture for the configured ms when
    set; on completion it calls ondismiss against this toast's id,
    which ToastRoot retains-filters out of TOASTS.

Manual dismiss continues to work for every variant (the X button
calls the same handler).

#MAPPS-312

QA report: a normal session piled up 5+ Success toasts in the bottom-right that all required manual close. The global `push_toast` had no timer at all; every variant stuck until the user clicked X. Fix: - `Toast` gains `auto_dismiss_ms: Option<u32>`. `None` = sticky (the existing behaviour); `Some(ms)` = scheduled dismiss. - `push_toast` and `push_toast_with_title` set the default per `AlertType`: Success / Info -> Some(5_000), Warning / Error -> None. A real failure cannot be missed by a user who tabbed away. - `ToastContainer` now iterates into a new internal `ToastRow` component keyed by toast id. The split is required so the timer effect scopes to a single id - a `use_effect` in the container would fire once per list change and either spawn duplicates or schedule against the wrong row. - `ToastRow::use_effect` runs once on mount and spawns a `gloo_timers::future::TimeoutFuture` for the configured ms when set; on completion it calls `ondismiss` against this toast's id, which `ToastRoot` retains-filters out of `TOASTS`. Manual dismiss continues to work for every variant (the X button calls the same handler). #MAPPS-312
feat(toasts): auto-dismiss Success/Info after 5s; keep Warning/Error sticky (MAPPS-312)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 17m12s
Create release / Create release from merged PR (pull_request) Has been skipped
9297e2f2fe
QA report: a normal session piled up 5+ Success toasts in the
bottom-right that all required manual close. The global
`push_toast` had no timer at all; every variant stuck until the
user clicked X.

Fix:
- `Toast` gains `auto_dismiss_ms: Option<u32>`. `None` = sticky
  (the existing behaviour); `Some(ms)` = scheduled dismiss.
- `push_toast` and `push_toast_with_title` set the default per
  `AlertType`: Success / Info -> Some(5_000), Warning / Error ->
  None. A real failure cannot be missed by a user who tabbed away.
- `ToastContainer` now iterates into a new internal `ToastRow`
  component keyed by toast id. The split is required so the timer
  effect scopes to a single id - a `use_effect` in the container
  would fire once per list change and either spawn duplicates or
  schedule against the wrong row.
- `ToastRow::use_effect` runs once on mount and spawns a
  `gloo_timers::future::TimeoutFuture` for the configured ms when
  set; on completion it calls `ondismiss` against this toast's id,
  which `ToastRoot` retains-filters out of `TOASTS`.

Manual dismiss continues to work for every variant (the X button
calls the same handler).

#MAPPS-312
YousifShkara deleted branch fix/MAPPS-312-toast-auto-dismiss 2026-06-25 11:02:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!343
No description provided.