Alert emits a hide event asynchronously from beforeUnmount.
AlertList handles the Alert's hide event; the handler is wired up in the template.
To reproduce the bug, click the "Toggle Alerts" button, which removes the AlertList, and its Alerts, from the DOM via vIf.
In the Vue 3 version, the hide event handler fires after AlertList's unmounted lifecycle hook. Consequently, $ref and injected dependencies are not available.
In the Vue 2 version, event listeners are removed before the component is unmounted (destroyed in Vue 2). As such, the hide event handler does not fire.
What is expected?
Event listeners should be torn down after beforeUnmount and before unmounted. Event handlers should not run after a component is unmounted. As it stands, this is an undocumented breaking change between Vue 2 and Vue 3.
What is actually happening?
Event handlers (in this case, AlertList#logHide) fire after unmounted.
For context, our application uses UIkit. Some of the UIkit components emit events asynchronously after an animation occurs. For example, the Offcanvas, Accordion, and Modal components emit hide events after they slide closed, which takes a small amount of time to animate. In our project, we sometimes handle these hide events, but the handlers erroneously (IMO) fire event after the component is unmounted.
The text was updated successfully, but these errors were encountered: