I’m looking for examples where people took LiveView and made it behave like a Single Page Application. This would mean the page’s HTML loads instantly on every click, and the data follows later (but never blocks).
I haven’t really looked at LiveView in years but recently went through some of the API and I see there are a few async related functions added so it makes me wonder if someone might have a demo of all of the async in action
“HTML loads instantly” is by the very definition of Liveview being server side rendered, not possible. Yes, rendering HTML is very fast (sometimes single ms) but you do have to add the latency to the server as well.
Normally you don’t notice this latency but to be pedantic for the sake of being pedantic, liveview is not “instant HTML” like an SPA.
To me it seems that showing a “Loading…” state is relatively easy. Where I am struggling to see how one can build a full SPA with LiveView is that, by definition (or so it seems to me), a single LiveView is to be used to render relatively similar UI based on similar data; it’s not geared towards showing completely different pages with different layouts and loading completely different data. So you will need to create multiple LiveViews and then navigate between them. I don’t know - maybe that’s still an SPA from the point of view of the user?