Application reloading often not working properly... :-(

The application reload during development does not work properly. Much too frequently while developing and debugging after I entered some source modification I end up in this exception:

2021-01-11 22:43:29,106 ERROR [http-nio-8080-exec-6]
myapplication.ui.view.nodes.NodeView:
java.lang.IllegalStateException: Can’t move a node from one state tree to another. If this is intentional, first remove the node from its current state tree by calling removeFromTree
at com.vaadin.flow.internal.StateNode.doSetTree(StateNode.java:717)
at com.vaadin.flow.internal.StateNode.lambda$setTree$3(StateNode.java:370)
at com.vaadin.flow.internal.StateNode.visitNodeTree(StateNode.java:670)
at com.vaadin.flow.internal.StateNode.setTree(StateNode.java:370)
at com.vaadin.flow.internal.StateNode.setParent(StateNode.java:270)
at com.vaadin.flow.internal.nodefeature.NodeFeature.attachPotentialChild(NodeFeature.java:78)
at com.vaadin.flow.internal.nodefeature.StateNodeNodeList.add(StateNodeNodeList.java:53)
at com.vaadin.flow.internal.nodefeature.ElementChildrenList.add(ElementChildrenList.java:42)
at com.vaadin.flow.dom.impl.AbstractNodeStateProvider.insertChild(AbstractNodeStateProvider.java:102)
at com.vaadin.flow.dom.Node.insertChild(Node.java:294)
at com.vaadin.flow.dom.Node.appendChild(Node.java:141)
at com.vaadin.flow.component.HasComponents.add(HasComponents.java:55)
at myapplication.ui.view.nodes.NodeView.editNode(NodeView.java:379)
at myapplication.ui.view.nodes.NodeView.lambda$15(NodeView.java:246)
at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:205)

I.e. I edit something in my application, wait a few seconds until it has been rebuilt. Then I go to the browser and trigger a reload.
If things go well, I get another login-panel, I log-in and then the application is reloaded and I can “exercise” the just modified version.
Very often, however, I instead get the above exception and then the application is “broken”, i.e. I found no way to get it working again.
Reloading the page, even killing and restarting the browser will not get it into a working mode anymore. All it is emitting is this darn “java.lang.IllegalStateException”. The only way out is to stop and restart the application (and then reload the browser, once the UI has been compiled). :frowning: