Skip to content

Commit cedc175

Browse files
waleedlatif1claude
andcommitted
fix(emcn/toast): reset expanded when the stack empties
The hover wrapper unmounts without firing mouse-leave when the last toast goes (dismiss / clear-all / navigation), so expanded could stay true and stop the next toasts from auto-dismissing. Force expanded false whenever the stack is empty. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6d14ace commit cedc175

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • apps/sim/components/emcn/components/toast

apps/sim/components/emcn/components/toast/toast.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,16 @@ export function ToastProvider({ children }: { children?: ReactNode }) {
522522
setMounted(true)
523523
}, [])
524524

525+
/**
526+
* Reset the hover-expanded flag whenever the stack empties. The hover wrapper
527+
* unmounts without firing mouse-leave when the last toast goes (dismiss / clear
528+
* / navigation), so without this `expanded` could stay `true` and stop the next
529+
* toasts from auto-dismissing.
530+
*/
531+
useEffect(() => {
532+
if (toasts.length === 0) setExpanded(false)
533+
}, [toasts.length])
534+
525535
/**
526536
* Adds a toast. Actionable toasts persist (`duration: 0`) unless an explicit
527537
* `duration` is given. When the stack exceeds `STACK_LIMIT` the oldest

0 commit comments

Comments
 (0)