It will (usually) run twice. Once when the http request renders the LV statically and then each time the websocket connection starts, which could also happen multiple times if the connection drops intermittently.
There is no data – besides the session – being shared between the static render and the connected renders. You either build the system in a way to not need the assign in the connected render or you need to query the data again.
A key thing missing in this thread is that if you use push_redirect and the other navigation helpers then the websocket connection is maintained. This means that you only do the double render on at the first moment the user goes to the site. After that it can simply do a single render.
Here’s an example from an older thread if you would rather query the db only after connected?(socket) == true. The entire thread is well worth the read and explains the context behind LiveView’s lifecycle architecture/design.