Page refresh pushes session out of sync

I have some background thread, which works long time and changes ui. If user refreshes the page ui goes out of sync. I have an example app https://github.com/asdnf/vaadin-push-issue-test.git .
Is there a common approach to handle these errors?

Hi,

have you tried using the @PreserveOnRefresh annotation in your UI?

-Olli

Seems like it resolves my issue. Thank you.

You’re welcome! Note that introducing @PreserveOnRefresh has some potential downsides, like if your app ends up in an invalid state, you can’t just reload the page to get out of it.

-Olli