components icon indicating copy to clipboard operation
components copied to clipboard

[P2] Fix snackbar timer races, dismissal reasons, and lifecycle cleanup

Open Banegasn opened this issue 4 months ago • 1 comments

Objective

Make snackbar show/hide timing deterministic under reopen, duration changes, reduced motion, actions, and disconnects.

Evidence

  • Only the auto-dismiss timer is tracked.
  • Exit uses an untracked 350 ms timeout while CSS exit duration is 400 ms.
  • Reopening during exit can be closed by a stale callback.
  • Disconnect does not clear the exit callback, and duration changes while open do not restart predictably.

Scope

Track/cancel all timers or use animation completion, define repeated show/reopen/duration/action behavior, emit one dismissal with a reason, and coordinate reduced-motion completion.

Acceptance criteria

  • [ ] Reopening during exit remains open.
  • [ ] Disconnect leaves no pending callback.
  • [ ] Duration changes follow the documented restart policy.
  • [ ] Dismiss fires exactly once with reason: timeout, action, programmatic, or replacement as applicable.
  • [ ] DOM/state transition follows actual animation completion and reduced-motion mode.
  • [ ] Deterministic fake-clock or event-driven tests cover race cases.

Dependencies

Blocked by #5, #6, and coordinate with #13.

Autonomous execution contract

Do not fix races by adding arbitrary delays; bind state changes to one tracked lifecycle.

Banegasn avatar Jul 13 '26 08:07 Banegasn

Motion (#13), toolchain, and protected CI prerequisites are merged. This focused lifecycle race fix is agent-ready; bind state to tracked lifecycle/animation completion rather than adding arbitrary delays.

Banegasn avatar Jul 29 '26 16:07 Banegasn