-
-
Notifications
You must be signed in to change notification settings - Fork 674
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
fix(toast): specific behavior if delay is provided in pending toast #729
Conversation
Commit ea54546 is fixing the problem described in first comment. Now it seems that all is working as expected (from my point of view). Edit: To test it you can change the code in example/components/App.tsx:
In this case, success/error toasts will be displayed after 1000ms without displaying the pending toast. If you reverse the delays, pending toast will appear after 1000ms and success/error toasts will be displayed after 5000ms. |
I created 2 sandboxes:
I created a npm package for myself but in case anyone wants it, here is the link: https://www.npmjs.com/package/potassium-react-toastify |
This reverts commit a1bb8d7.
@fkhadra Please, could you tell me what would you need to take a look at this PR ? Some people are downloading my custom package so I think that this is an interesting thing to add. If you did not understand something or if you need more explanations, you can ask... thank you. |
…unexpected behaviors
Hey @git-angelo , I totally miss your PR, sorry for that. I've addressed this issue in v9. |
If a delay is provided in "pending" toast and if the Promise is completed before it, we should not display the "pending" toast.
PS: I will clean this PR but I pushed a kind of "PoC" to eventually discuss about this feature.
PS 2: PR does not work as expected in real use case. It is waiting the end of the delay before returning the result if the promise ends quickly. Nevertheless, it can be used with a delay value of "500" to avoid seeing the pending toast in most of the cases without problem.