fix multiwindow due to mounts not dropping in virtualdom #4351
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From #3588
This is a separate issue entirely - we don't need to change desktop itself, but instead manually change the drop order of the VirtualDom itself.
The virtualdom and the runtime are separate objects, and the data for the onclick handler lives inside the runtime, not the virtualdom. When we call webviews.remove(id), we don't call root.destroy(), and thus the event handlers and their state still persists.
Basically, when a VirtualDom is dropped, we don't unmount any of its handlers from the actual DOM. This leads to a memory leak and then, for desktop, windows not dropping.
The solution is to empty a runtime's state when the virtualdom is dropped.