I am contributing to a project where I observe a pattern such that sometimes inside a LiveView mount/3
we check for if connected?(socket)
and only when true
do we do an expensive database fetch and put the list in the assigns.
I have historically assumed that there was a LiveView expectation that the rendered template from the initial non-connected render should be the same as the connected render. Partially this is to solve for the wanted benefit of a user/browser/robot who does not have Javascript and still gets a valid HTML page (not a concern for our specific app since it is not a public website) — however, the second reason I thought would have been for the change tracking innards of LiveView.
Wouldn’t LiveView need those renders to align for the change tracking to work properly?
Or am I to understand it such that once the websocket connection happens, LiveView dumps the entirety of the previous render and replaces it with the outcome of the second “connected render” and uses that as the starting point of change tracking?
Thanks for your help.