Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonner 2.0.0: flushSync was called from inside a lifecycle method #584

Closed
rwieruch opened this issue Feb 19, 2025 · 2 comments
Closed

Sonner 2.0.0: flushSync was called from inside a lifecycle method #584

rwieruch opened this issue Feb 19, 2025 · 2 comments

Comments

@rwieruch
Copy link

After upgrading from 1.7.4 to 2.00 I get the following error:

flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task. Error Component Stack

I am calling the toast method in a useEffect hook:

useEffect(() => {
    if (!actionState) return;

    if (actionState.status === "SUCCESS") {
      toast.success(actionState.message);
    }
  }, [actionState]);
};

Nothing to stress about, I was just wondering whether this could be related to the recent 2.0.0 release.

@emilkowalski
Copy link
Owner

Fixed in #586, please update to version 2.0.1

@rwieruch
Copy link
Author

Wow, perfect. Thanks @emilkowalski Great work 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants