Skip to content

[Bug] React Toast - Clear timer when Toast is hidden #1302

@kajabimark

Description

@kajabimark

Detailed description

Chrome 100.0.4896.60
When toggling visibility on a <Toast /> component, the 2nd time the component shows it's still using the same timer.

I was expecting the timer to reset each time the Toast is no longer active

Possible solution

Maybe just clear the setTimeout each time the Toast is dismissed

Steps to reproduce

Describe the steps to reproduce the behavior:

  1. Set the timeout prop on a Toast component to 6000
  2. Show, then hide the Toast
  3. Wait a few seconds
  4. Show the Toast again, and notice that it's only visible for whatever time remains from the initial 6 seconds

Screenshots

react-toast-timeout.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions