Using tabs to navigate - crash on logout

Hi! I have a small project that uses AppLayout and Tab in the Drawer to navigate.
If I log in it works perfect, when I log out and then log in again, it stops working and says:
“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”

I’m not using “@PreserveOnRefresh” wich I saw on GitHub has a similar problem, not sure why its happening the error, but I think it’s on the creation of the new page at the moment of display (i do rest call’s ok, then at the moment of add(content) its when it crash)
unknown.png
unknown.png
unknown.png
unknown.png

those are the tabs

You are mixing spring scopes - one or more of your components is annotated with the wrong scope

oh !! ok!!

unknown.png

in my Views i usually dont even put @Scope, its needed?

GridView (my super for all views) its just a VerticalLayout+BeforeEnterObserver
unknown.png

The component annotation is the problem - now your view is a singleton and only once available for all users (which doesn’t work)

https://vaadin.com/docs/latest/integrations/spring/scopes has informations about the available scopes for UI components

thx!!

Replacing the usage of the component annotation with @SpringComponent on your views / components should solve it

Even tho the annotation is not needed on views, Vaadin allows you to inject / autowire other beans in the views even without the annotation - it’s often only added to make IDEs happy

ok perfect!