toast.loading() doesn't close after toast.update() with autoClose parameter
See original GitHub issueHi
When i trying to call an .update() to a toast.loading, it succesfully updates, but doesn’t close with autoClose parameter.
My piece of code:
const toastLoading = toast.loading("Registering...");
registerTeam()
.then((res) => {
toast.update(toastLoading, { render: "Team registered!", type: "success", isLoading: false, autoClose: 2000 });
}
I did all directly from this official guide, but it doesn’t work
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
The success toast on promise does not disappear. #725
Possible source of the problem: solve the Promise too quickly (almost immediately). Now I notice that sometimes it works, sometimes it doesn't.
Read more >why toast.update in React-Toastify v.9 doesn't work properly
You have to set the loading to false for the autoClose to work. So add isLoading: false to the toast.update . toast.update(toast1, {...
Read more >toast() API
toast() API. Call it to create a toast from anywhere, even outside React. Make sure you add the <Toaster/> component to your app...
Read more >Handling autoClose | React-Toastify - GitHub Pages
The autoClose prop accept a duration in milliseconds or false . #Change the default delay. Copy. import React from 'react';. import { ToastContainer...
Read more >Toasts overview - Android Developers
Instantiate a Toast object. Use the makeText() method, which takes the following parameters: The application Context . The text ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Rafatcb I managed to fix the bug locally. I’ll do my best to plan a release this weekend. Huge thank you for the reproduction it’s helped a lot
@fkhadra I noticed another bug that may have the same source — that’s why I’m not opening a new issue.
When I try to update a
loading
toast and change itsclassName
, it’s not updated if the toast is updated too fast (e.g. in 100ms). I created a repro on Code Sandbox. This bug was introduced on v8.2.0.It was probably introduced by this commit: https://github.com/fkhadra/react-toastify/commit/25808ac2ce7ef70e5e003fe6d9af45455c8d786e