Vaadin 12: New UI after browser refresh

Is it expected, that every refresh of the browser tab creates a new UI? I´m also working with CDI and that makes the UIScope not very handy.

So in other words, do you need PreserveOnRefresh like it was with Vaadin 8?

https://github.com/vaadin/flow/issues/4665

If that will fix the issue, then yes. But i never used that in Vaadin8 with CDI. The UIScope works fine there

hi,

a workaround: if there is data you want to keep on pagerefresh, create a class which is @VaadinSessionScope annotated. That class will be preserved until you leave the application, so basically shared in the same browser

Chris Marques:
hi,

a workaround: if there is data you want to keep on pagerefresh, create a class which is @VaadinSessionScope annotated. That class will be preserved until you leave the application, so basically shared in the same browser

Where is @VaadinSessionScope ? I can’t locate it.

Syam Pillai:

Chris Marques:
hi,

a workaround: if there is data you want to keep on pagerefresh, create a class which is @VaadinSessionScope annotated. That class will be preserved until you leave the application, so basically shared in the same browser

Where is @VaadinSessionScope ? I can’t locate it.

Use this addon to add it
https://vaadin.com/directory/component/vaadin-cdi

Another thing is, that a browser refresh is not calling onDetach() of the current displayed route/view. What is the preferred way to handle a browser refresh to execute some logic in the view class?