Skip to content

fix: ignore toast promise message if promiseData is undefined or some…#670

Open
dev-mmh wants to merge 1 commit intoemilkowalski:mainfrom
dev-mmh:fix/ignore-toast-promise-by-promisedata
Open

fix: ignore toast promise message if promiseData is undefined or some…#670
dev-mmh wants to merge 1 commit intoemilkowalski:mainfrom
dev-mmh:fix/ignore-toast-promise-by-promisedata

Conversation

@dev-mmh
Copy link
Copy Markdown

@dev-mmh dev-mmh commented Jul 21, 2025

…thing

fix issues
#669

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 5:51pm

@dev-mmh
Copy link
Copy Markdown
Author

dev-mmh commented Jul 21, 2025

I want to dismiss toast promise based on condition like this

toast.promise(promise(), {
   loading: "Loading...",
   success: ({ data }) => {
      if (data.message === "something") {
         // skip the toast
         return undefined;
      }
      return "Success!";
   },
   error: (error) => {
      if(error.status === 404) {
         // skip the toast 
         return undefined
      }
      return "Error"
   }
});

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

Successfully merging this pull request may close these issues.

1 participant