teodosii / react-notifications-component

Delightful and highly customisable React Component to notify your users
https://teodosii.github.io/react-notifications-component/
MIT License
1.27k stars 73 forks source link

Multiple notifications make last notification unable to dismiss #44

Closed andergabilondo closed 4 years ago

andergabilondo commented 4 years ago

When more than 20 notifications arrive without dismissing any of them, the last one remains, unable to dismiss.

To test it:

`const notificationInterval = setInterval( () => storeNotification.addNotification({ title: 'Wonderful!', message: 'teodosii@react-notifications-component', type: 'success', insert: 'top', container: 'top-right', animationIn: ['animated', 'fadeIn'], animationOut: ['animated', 'fadeOut'], dismiss: { duration: 0, onScreen: false } }), 1000 );

setTimeout(() => { clearInterval(notificationInterval); }, 22000)`

Thanks for the job, the component is awesome

andergabilondo commented 4 years ago

Here comes an update. The problem appears when you dismiss them quickly. The onRemoval function does not execute but the notifications are graphically dismissed. The result is a notification that is not possible to remove.

teodosii commented 4 years ago

I tried on GitHub pages and I was not able to reproduce. You're saying onRemoval is not being executed but your example does not have any onRemoval callback. Could you record your screen while doing this? As gif would help. Or provide an example that I'll be able to reproduce it each time, otherwise I cannot help you.

I double checked the handling for dismissal and it's always updating the previous state which should always result in correct dismissal.

andergabilondo commented 4 years ago

Fail

Hello, I have tried to reproduce the issue with the github pages. I achieved it partially,

The problem comes in the mobile device emulation. I created a console.log with a counter that prints on every dismiss. If you click fast in the first notification before the transition completes, the onRemoval action is not executed.

let counter = 0; ... onRemoval: () => { console.log(counter); counter++; },

In my code (haven't found the reason yet), the result is shown in the gif. The notifications are fixed and unable to remove.

Thanks for your support!

teodosii commented 4 years ago

Thank you for details, will look into it but most likely will get fixed after New Year

teodosii commented 4 years ago

I've tried reproducing this bug but it didn't happen to me. Not even once. Could you have a look again at that? I really don't know what would be causing this as I tried manually spamming notifications and each of them gets closed afterwards. Will close it for now and I'm waiting for your answer.