Preserve UI on GET method

Hi all,

I would like to always preserve the UI on refresh. I used the annotation : @PreserveOnRefresh and it works well when I refresh the browser.

However, when I tape something in the address bar and I tape enter, GET method is sent to the server.

Following this, UIInitHandler will check for known UI session.getPreserveOnRefreshUIs(); but can not find it because VaadinBootstrap.js created a new id for the UI window.

(This is my humble interpretation of the code)

In my use case, I want to preserve the UI even if the request is a GET method.


On a browser refresh, the browser keeps the “window id” so that it is possible for Vaadin to know which UI was refreshed.

When typing to the address bar, browsers reset the window id for security reasons. Because of this, it is not possible for a Vaadin application to know what UI was refreshed.

Thus, as far as I know, this is not possible to implement without breaking the support of multiple different UIs for the same Vaadin application on different browser tabs.

BTW, the title was a little misleading as also a refresh leads to a GET method being used.

Mohammed if this is not important for you, see here!/thread/2882640

Henri, Giovanni, thank you for your answers.

I used the previous code and that’s what I want :slight_smile: