timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.84k stars 331 forks source link

After toast.remove(t.id), other toast.error toast.success never disappear... #192

Open DonRyu opened 2 years ago

DonRyu commented 2 years ago

I am using Next.js

After Closing the custom toast message using

button onClick ( ( ) => toast.remove(t.id) )

toast.error(SEARCH_ERROR_MSG, { id: 'search_error' }); Never disappear...

The default duration for errpr is 2000 milliseconds... (If I don't use toast.remove(t.id) for toast.custom(toast.dimiss(t.id) , toast.error disappear well)

timolins commented 2 years ago

Hi! Can you create a Codesandbox/Stackblitz that reproduces this issue?

aleda145 commented 2 years ago

I encountered an issue like this as well. I'm using react query and on a mutation success call I would remove a toast and then show a success toast. About half the time the success toast just lingered and never disappeared.

But it works great after changing to toast.dismiss instead, thanks to OP for pointing that out :smile_cat:

imrea commented 1 year ago

Using toast.dismiss() instead of toast.remove() does temporarily solve the issue.

gitnlsn commented 12 months ago

Using toast.dismiss() instead of toast.remove() does temporarily solve the issue.

I had this issue. It helped me.

gitnlsn commented 12 months ago

whats the expected difference between dismiss and remove?

mogelbrod commented 10 months ago

I encountered the same issue when doing the following:

toast.dismiss('someId')
toast.error('Message', { id: 'someId', duration: Infinity })

The initial dismiss call is there to make the user see that it's a new notification. Calling these in sequence causes any subsequent dismiss of the new message to not remove it from the list.