You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
toast.promise fails to render ReactNode/JSX in success message
Description
When using toast.promise with JSX/ReactNode elements in the success message, the toast does not appear. However, if the JSX is removed and only a string is used, the message displays correctly. I confirmed this is a regression, as it works correctly in an older project using version 1.7.4.
Steps to reproduce
Create a promise-based function
Use toast.promise with JSX in the success message
Observe that the success toast doesn't render
Code example
// This doesn't work - success toast with JSX doesn't appeartoast.promise(myPromise,{loading: <div>Loading...</div>,success: (data)=>(<div>{data.name}<strong>worked</strong>!
</div>),error: 'Error',});// This works - success toast with string only appearstoast.promise(myPromise,{loading: <div>Loading...</div>,success: (data)=>`${data.name} toast has been added`,error: 'Error',});
Uh oh!
There was an error while loading. Please reload this page.
toast.promise fails to render ReactNode/JSX in success message
Description
When using
toast.promise
with JSX/ReactNode elements in the success message, the toast does not appear. However, if the JSX is removed and only a string is used, the message displays correctly. I confirmed this is a regression, as it works correctly in an older project using version 1.7.4.Steps to reproduce
toast.promise
with JSX in the success messageCode example
A live reproduction is available at: https://stackblitz.com/edit/react-s5gf8aew?file=src%2FApp.js
Expected behavior
The success toast should appear regardless of whether the message is a string or a ReactNode/JSX element, as it did in version 1.2.2.
Environment
The text was updated successfully, but these errors were encountered: