When Fabulous detects a widget is removed from the view tree, it will dispose the associated ViewNode, which in turn will dispose the whole dependency tree.
We need to rely on ViewNode.Dispose() because frameworks like Maui doesn't provide any event telling us when a control is removed from the UI tree. The Unloaded event of Maui for example is called as soon as the control is no longer visible (eg we navigated to another page, but the previous page is still supposed to be alive)
New dependency tree:
When Fabulous detects a widget is removed from the view tree, it will dispose the associated ViewNode, which in turn will dispose the whole dependency tree.
We need to rely on
ViewNode.Dispose()
because frameworks like Maui doesn't provide any event telling us when a control is removed from the UI tree. TheUnloaded
event of Maui for example is called as soon as the control is no longer visible (eg we navigated to another page, but the previous page is still supposed to be alive)