jwstegemann / fritz2

Easily build reactive web-apps in Kotlin based on flows and coroutines.
https://www.fritz2.dev
MIT License
653 stars 28 forks source link

Fix beforeUnmount Crashes due to Job Cancellations #795

Closed metin-kale closed 1 year ago

metin-kale commented 1 year ago

In more complex rendering hierarchies child-nodes might be unmounted, before the parents get unmounted. Thereforce we have to make sure that registered beforeUnmount-actions are only executed, if their job is still active, as it may be called by its own MountPoint or by any MountPoint of its parent.

This PR adds the necessary safety belts and unit tests.

If some beforeUnmount-action throws, the exception is caught and logged to the console in order to keep the application alive.