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
Have Toaster component implemented with useToaster hook
Have Toast component which reads toaster state using useToasterStore
Fire toast
Dismiss toast or wait for it to dismiss
Try to fire another toast --> nothing happens
Suspected root cause: when Toast gets unmounted, it removes wrong listener from the global listener array. So instead of removing the listener that Toast added, it removes the listener that Toaster added, i.e. besides just checking toasterId, it should also verify we are removing correct listener.
// src/core/store.tsuseEffect(()=>{// ...return()=>{constindex=listeners.findIndex(([id])=>id===toasterId);// <-- THE PROBLEMif(index>-1){listeners.splice(index,1);}};},[toasterId]);