feat(toasts): auto-dismiss Success/Info after 5s; keep Warning/Error sticky (MAPPS-312) #343
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-apps!343
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-312-toast-auto-dismiss"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
QA report: a normal session piled up 5+ Success toasts in the
bottom-right that all required manual close. The global
push_toasthad no timer at all; every variant stuck until theuser clicked X.
Fix:
Toastgainsauto_dismiss_ms: Option<u32>.None= sticky(the existing behaviour);
Some(ms)= scheduled dismiss.push_toastandpush_toast_with_titleset the default perAlertType: Success / Info -> Some(5_000), Warning / Error ->None. A real failure cannot be missed by a user who tabbed away.
ToastContainernow iterates into a new internalToastRowcomponent keyed by toast id. The split is required so the timer
effect scopes to a single id - a
use_effectin the containerwould fire once per list change and either spawn duplicates or
schedule against the wrong row.
ToastRow::use_effectruns once on mount and spawns agloo_timers::future::TimeoutFuturefor the configured ms whenset; on completion it calls
ondismissagainst this toast's id,which
ToastRootretains-filters out ofTOASTS.Manual dismiss continues to work for every variant (the X button
calls the same handler).
#MAPPS-312