Flow alternative for UI.getCurrent().getWindows()

I’m refactoring Vaadin8 Code to Vaadin24.
In Vaadin8 I’m using UI.getCurrent().getWindows().
Has Vaadin Flow (v24) an equivalent method or functionality?

The replacement for ‘Window’ is ‘Dialog’ in vaadin Flow. Check out the documentation. it says that by default dialogs are added to the previous dialog as child and not to the UI. What is your problem you are trying to solve?

https://vaadin.com/docs/latest/components/dialog

I tried using Dialog instead of Window but I got this Exception:

        at com.vaadin.flow.internal.StateNode.doSetTree(StateNode.java:768) ~[flow-server-24.2.1.jar:24.2.1]```

In Vaadin8 I solved it by calling all Windows and remove them.

But what is it that you’re trying to do?

Is your UI based on a bunch of root-level windows, and you need a method for closing all of them? If so, I think the best approach would be to have a global collection of all Dialogs and just iterate that and close them. (While Windows were kind of a special thing in V8, in V10+ they’re more like any other component)

Ok, thanks. I will try it with a global collection.

do not forget the scope of the collection. you probably want to do it in session scope.