oruga-ui / oruga

🐛 Oruga is a lightweight library of UI components without any CSS framework dependency
https://oruga-ui.com
MIT License
1.12k stars 169 forks source link

Programmatic modal close doesn't call onBeforeUnmount and onUnmounted #1070

Open IlyaSemenov opened 6 days ago

IlyaSemenov commented 6 days ago

Overview of the problem

Oruga version: 0.9.0-pre.1 Vuejs version: 5.4.9 OS/Browser: macOS/Chrome

Description

When using oruga.modal.open(...), and the modal is dismissed, onBeforeUnmount and onUnmounted are not called for the inner component (and all its children).

That breaks code that relies on the unmount callbacks, for example: https://github.com/TownSquareXYZ/tonconnect-ui-vue/blob/ee614c6b09efb3a9ef200887882a88de32a300d6/src/components/TonConnectButton.vue#L18-L24

Steps to reproduce

Reproduction: https://stackblitz.com/edit/vitejs-vite-2dzjwv

  1. Click "Programmatic Modal" button, then dismiss it by clicking at the overlay.
  2. Click "Inline Modal" button, then dismiss it.
  3. Examine the log output below.

Expected behavior

Both modals log 3 events each: onMounted, onBeforeUnmount, onUnmounted.

Actual behavior

Programmatic modal only logs onMounted, but not onBeforeUnmount and onUnmounted.

Inline modal logs all 3 events.

mlmoravek commented 1 day ago

Thank you!!! This issue is already known and fixed in dev and will be fixed in the release.