react-hot-toast icon indicating copy to clipboard operation
react-hot-toast copied to clipboard

Toast persists after page navigation

Open simerlec opened this issue 2 years ago • 1 comments

Hello 👋

thank you for the lib.

I believe I've found an issue when using it in a Nextjs application on page navigation. Here's a repo for what I encountered https://stackblitz.com/edit/stackblitz-starters-tvmp57?file=app%2Fpage.tsx&file=app%2Fpage2%2Fpage.tsx

The gist of it is, that we have a link to another page in one of our toasts and are dismissing it right after the user clicks the link. So toast shows up -> user clicks link in the toast -> dismiss (all) toast(s) -> navigate to new page. What happens now is that the dismiss call does not really work here. The toast briefly show up on the new page (and on subsequent navigations as well, which is especially jarring). Can it be the case that the navigation somehow interferes with the complete removal of the toast? I read in the docs that the dismiss function only triggers the exit animation and the toast gets removed after 1 second. Is that the problem here?

thank you and kind regards

Chris

simerlec avatar Jan 29 '24 15:01 simerlec

Seems like duplicate of #128

ParallelUniv3rse avatar Feb 21 '24 23:02 ParallelUniv3rse