equinor / mad

Experimental monorepo for the Mobile Application Delivery team
https://equinor.github.io/mad/
MIT License
8 stars 2 forks source link

Invoking `addToast` before `ToastEmitter` causes all future toasts to not show #604

Closed HaakonSvane closed 1 month ago

HaakonSvane commented 1 month ago

Package / App

Other

Version

mad-toast@latest

What happened?

If ToastEmitter is rendered after a call to addToast, all subsequent calls to addToast results in nothing happening. This bug was discovered first in the WorkOrders app after a toast is emitted from failed login-attempts that are done higher up in the render hierarcy

Other info

This bug seems to occur from the locking/unlocking mechanism in the toast queue. If an addToast call is made without an emitter, the onHide callback of the toast is never invoked, meaning that the queue will be locked for ever.

Relevant log output

No response