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 .
Is there a common approach to handle these errors?


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


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.