Closed amanjain14 closed 3 years ago
Yes, I am having the same issue with limit={1} and
App.js
<ToastContainer
className={classes.toastsContainer}
toastClassName={classes.notification}
progressClassName={classes.progress}
closeButton={
<CloseButton className={classes.notificationCloseButton} />
}
limit={1}
/>
notify-util.js
function sendNotification(componentProps, options) {
toast.clearWaitingQueue(); // <== clearing queue before every toast() call
return toast(<Notification {...componentProps} />, options);
}
Hey,
Could you provide a codesanbox with the issue thanks.
Hi, I am facing the same issue.
I have reproduced the issue in codesandbox, https://codesandbox.io/s/cranky-montalcini-gshqf?file=/src/AppNotifications.js
My use case:
Problem:
Hope it's clear. Could someone suggest a solution to this problem?
PS: This is my first post - so, please suggest if I need to explain the problem in a better way.
Hey @anoopvasudevan , the codesanbox seems to be empty :(
@fkhadra Oh! Sorry about that. Looks like I didn't save the code properly. Let me create it again & get back to you.
@fkhadra Here you go, https://codesandbox.io/s/react-toastify-example-gshqf?file=/src/App.js
data loads in every 10 seconds
Thanks for the reproduction.
TL;DR; So here is a working example to unlock you. I've removed the container id
This is clearly a bug 🤣, oops sorry. I'll deploy a fix ASAP. Thanks a lot for the reproduction, it helped a lot
function clearWaitingQueue({ containerId }: ClearWaitingQueueParams) {
const { limit, enableMultiContainer } = instance.props;
if (
limit &&
(!containerId ||
(instance.containerId === containerId && enableMultiContainer))
) {
toastCount -= queue.length;
queue = [];
}
}
@fkhadra Thanks. That fix will work for me.
toast.clearWaitingQueue() is not clearing the queue when a queue is created by making a toast again and again P.S. using limit-{3}