Purpose of AttachEvent#initialAttach in combination with @PreserveOnRefresh

Hello,
I would like to ask what is the purpose of the field initialAttach in AttachEvent.
We are currently using this to decide whether the content of some component has been already created or not. If the isInitialAttach is true, we create the content, otherwise we don’t.
But in combination with @PreserveOnRefresh this seems to be useless, because the initialAttach is true when the browser tab is refreshed and then the content of the component is created twice, because the old content was not removed.

So what’s the intended usage here? Is our current usage wrong by definition? In my opinion since the content of the components is preserved on refresh, the initialAttach should be false too, because the components were already attached before, although to a different UI instance it seems.

Thanks.

I think you should read this ticket discussion thru in detail and then reflect what is your actual use case, and whether the things mentioned in the discussion would give you some solutions: Add flag to tell if DetachEvent happened because of resynchronization · Issue #18443 · vaadin/flow · GitHub