Refreshing @PreserveOnRefresh layout

Hi,

Maybe someone can help me. Is there any way to refresh a layout anottated with @PreserveOnRefresh programatically? I want to have a button which changes some internal things and I need all of the view refreshed (new instance constructed) when it is clicked. I use Vaadin 14 with flow.
On Vaadin 7 it was possible to close current UI and reload. Maybe something is similar is available for the views too?

Hi Martynas.

Have you looked at this? You can modify pretty much anything asyncronously.

https://vaadin.com/docs/v14/flow/advanced/tutorial-push-access.html

Thanks for your answer. Yes, I looked at @Push functionality. I would like to just recreate the class (same behaviour as there were no @PreserveOnRefresh), because like that I would not have to do any additional programming. But if there is no such way I will probably have to refactor. I just thought that you could force recreation of view like you could force recreation of UI with close and reload.