You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using global context to manage my Toasts. I'm noticing that after removing the Toast on a swipe, the next toast stays in view infinitely because context.isClosePausedRef.current is never set to false again as hasToasts equates to false after the swipe event.
Expected behavior
I'd like to see the context.isClosePausedRef.current be reset if there are no Toasts available and it's still set to true
Suggested solution
in Toast.tsx, I think adding this code:
if (!hasToasts && context.isClosePausedRef.current) {
context.isClosePausedRef.current = false;
}
above this line:
if (hasToasts && wrapper && viewport) {
Could solve the issue. While debugging the node module file, I found that after a successful swipe that makes the toast disappear. There's a final event in the useEffect code that wraps the code above, where hasToasts is not available, making it so that the isClosePausedRef state can never be reset properly. It could be that my state mutations take a bit longer than the example Toast in the documentation, which would cause this behavior.
Your environment
Software
Name(s)
Version
Radix Package(s)
@radix-ui/react-toast
^1.2.4
React
n/a
18.2.0
Browser
Chrome
Assistive tech
Node
n/a
npm/yarn
PNPM
>=7.0.0 < 8.0.0
Operating System
MacOs
Sequoia 15.1
The text was updated successfully, but these errors were encountered:
Bug report
Current Behavior
I'm using global context to manage my Toasts. I'm noticing that after removing the Toast on a swipe, the next toast stays in view infinitely because context.isClosePausedRef.current is never set to false again as hasToasts equates to false after the swipe event.
Expected behavior
I'd like to see the context.isClosePausedRef.current be reset if there are no Toasts available and it's still set to true
Suggested solution
in Toast.tsx, I think adding this code:
above this line:
Could solve the issue. While debugging the node module file, I found that after a successful swipe that makes the toast disappear. There's a final event in the useEffect code that wraps the code above, where hasToasts is not available, making it so that the isClosePausedRef state can never be reset properly. It could be that my state mutations take a bit longer than the example Toast in the documentation, which would cause this behavior.
Your environment
The text was updated successfully, but these errors were encountered: