Is it possible to have a normal server rendered app (vanilla Phoenix app) with only part of the page(s) based on LiveView?
A multi page app, where there is a small part which is intact from page to page and is based on LiveView while the rest of the app is a vanilla multi page Phoenix app. Like a small chat box in a multi page app for customer support etc.
You can use a iframe. The downside is the flow of the layout. You’d have to give it a precalculated size.
Thank you for the reply!
I wish there was a solution like Trubolinks’
data-turbolinks-permanent attribute. Also I wish LiveView could be used on only a small part of a webpage.
Turbolink’s core functionality can be implemented with a couple hundred lines of code with vanilla JS and Phoenix (you don’t need Liveview for that), if you control both the server side and the client side. Turbolink’s complexity mainly stem from the need to be more generic and to work with everything.
LiveView is much, much more. So it is more finicky. I’d suggest you to make everything liveview if you need a part to be alive. For the static parts, there is no run time cost if you don’t change them.
I heard that currently LiveView’s response time isn’t great if you don’t host it on Fly.io.
Yes. You can have it only on some routes or render only on part of a page as a widget. See the docs for live_render.
This is not true at all.
Fly.io gets you closer to your users, which means any server-based application could benefit from Fly.io.
LiveView response time is actually better than regular HTTP requests because it works over an existing authenticated web socket connection. So the work of parsing headers, authenticate users, etc is not done on every interaction.
The quoted sentence only applies if you try to use LiveView for client-only interactions, but the docs are very clear that you should not do that.
Thank you for clearing my confusion!