Going back to previous page clears all data

I’ve two pages A & B. When I move from Page A to Page B and then back to Page A, all the form values entered while in Page A gets vanished.

I’m able to retain the form values in Page A by using @PreseverOnRefresh if someone refreshes it but moving back to the page is not. Please let me know how could I retain the values in Page A.

I’m assuming you’re using Vaadin 14. If you are using Spring, you can annotate your routes with @UIScope, which means that your routes will have the same lifetime as the UI (the current browser tab). There are a couple of things to look out for: 1) lots of UI scoped views will take more memory on the server, as you need to store the state for longer. 2) UI instances aren’t reused with @PreserveOnRefresh - meaning you can’t expect the other @UIScoped routes to keep stored after a browser reload. See this ticket for more info on the second point: https://github.com/vaadin/flow/issues/6395