Skip to content

Commit b2ddca9

Browse files
authored
fix: add try-catch to removing UIs (#22200) (#22323)
1 parent 0d1ea4d commit b2ddca9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,12 @@ public void setSession(VaadinSession session) {
451451
+ ".");
452452
} else {
453453
if (session == null) {
454-
ui.getElement().getNode().setParent(null);
454+
try {
455+
ui.getElement().getNode().setParent(null);
456+
} catch (IllegalStateException e) {
457+
getLogger().warn("Error detaching closed UI {} ",
458+
ui.getUIId(), e);
459+
}
455460
// Disable push when the UI is detached. Otherwise the
456461
// push connection and possibly VaadinSession will live on.
457462
ui.getPushConfiguration().setPushMode(PushMode.DISABLED);

0 commit comments

Comments
 (0)