Skip to content

Toast onOpenChange not being called #2195

Discussion options

You must be logged in to vote

Hey @stevecastaneda, when you are controlling a prop, you tell the component what value that prop should be (so here open tells the component when it should be open). The component then tells you when "it" has made changes internally, via a callback, essentially telling you to update the value your side (so here onOpenChange).

Now, consider that Toast never needs to tell you it needs to "open", because you have told it to open, it will however tell you when it needs to close (for example when the timer expires, or when the close button is pressed).

So you will never see onOpenChange being called with true.

This is how any controlled prop work in React. Think about value, onChange on an input

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stevecastaneda
Comment options

@joaom00
Comment options

@stevecastaneda
Comment options

Answer selected by benoitgrelard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants