question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

toast.loading() doesn't close after toast.update() with autoClose parameter

See original GitHub issue

Hi

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fkhadracommented, Mar 25, 2022

@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

2reactions
Rafatcbcommented, Mar 25, 2022

@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 its className, 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.

v8.1.1 v8.2.0
className applied when updating the toast for both 100ms and 1000ms of delay className not applied when updating the toast for both 100ms

It was probably introduced by this commit: https://github.com/fkhadra/react-toastify/commit/25808ac2ce7ef70e5e003fe6d9af45455c8d786e

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found