-
-
Notifications
You must be signed in to change notification settings - Fork 740
Description
react: 19.2.4
toastify: 11.0.5
Screen.Recording.2026-02-11.at.17.58.55.mov
reading the code, dismiss does markAsRemoved https://github.com/fkhadra/react-toastify/blob/main/src/core/containerObserver.ts#L52
it does not really remove the toast. the onChange does not fire either https://fkhadra.github.io/react-toastify/listen-for-changes
next time toast() is triggered, the onChange fires with the new toast status: added and then after that one the previous one is really removed with status: removed. this causes the behavior in the video.
the code seems that it should work nonetheless but I am guessing thats due to react: 19.2.4
the listeners has the following:
function() { checkIfSnapshotChanged(inst) && (startUpdateTimerByLane(2, "updateSyncExternalStore()", fiber), forceStoreRerender(fiber)); }
from the react-dom source code:
function subscribeToStore(fiber, inst, subscribe) {
return subscribe(function() {
checkIfSnapshotChanged(inst) && (startUpdateTimerByLane(2, "updateSyncExternalStore()", fiber), forceStoreRerender(fiber));
});
}
most likely has to do with how react 19 uses https://react.dev/reference/react/useSyncExternalStore
I also noticed that it bugs out with multiple toasts
got no reproducable link unfortunately.
patches
- add the below to
onCloseof the options passed for the toast
toast.update('THE ALERT ID', {
render: () => null,
containerId: 'THE CONTAINER ID', //remove when not using containers
})