When would I not use LiveView?

When starting a new project, what are the constraints/limitations of LiveView that we should consider?

With a polyfil LiveView supports IE9. What about performance? Animations? Debugging? UX/design?

Has anyone had to remove LiveView from an existing project? If so why?

Thank you

I usually build frontend with Vue.js, so most of the time I just stick to vanilla WebSocket solution. Besides, I’m still looking for a way to broadcast events to live views. I think the ability to make effects on others’ browsers/clients is the charm of WebSocket, but I’m still trying to find a way doing so with LiveView.

Quite a lot of the constraints are laid out in the various talks introducing LiveView. It is considered a poor fit for animations, it isn’t suitable for any offline scenarios and super complex UX. Anything where latency may become an issue is likely to be a poor fit. A lot of the games developed early on and hosted in US or European data centres were hopeless where I live (Australia) - the 200ms+ round trip renders them unplayable. But pretty well everything else was fine.

In terms of debugging, I personally find it pretty straightforward and I mostly just use IO.inspect - the reload time is so fast you can jam an IO.inspect in and 2-3 seconds later see the state of your liveview into the console. If I compare debugging effort so far (about 6 person weeks into a project), about 2/3 is in getting webpack and CSS to do supposedly straightforward things, about 2/3 of the remainder on JS interop, and the balance on the server side where the vast majority of the logic lies.

I can’t speak to performance at scale as yet, but the response times are ridiculously fast (I’m currently developing on a spare 9 year-old Thinkpad just so I could give Kubuntu a whirl) so I would suspect that memory is going to be more of an issue initially - this is already discussed on various threads in the forums.

Are there any particular UX/Design scenarios you have in mind that may be an issue? You could take a look at https://phoenixphrenzy.com/results - there is a pretty decent range of designs there.

I haven’t removed LV, but then I don’t have anything in production as yet. I have rewritten quite a few non-LV controllers/views as I find the LV lifecycle much simpler to work with for the way my brain is wired.

One thing to be aware of - it is pre v1.0 so things change and can break. For example, I had to move quite a lot of logic from mount to handle_params on one of the updates.

So sorry, no real negative opinions as yet from me to balance your view - I’m still a fan.

6 Likes

I would not use it for anything that gets degraded if latency is high. For example, if you want to expose your website to people from all over the world, where internet connections might not be very reliable, or too far away from your servers.

For instance, I could test very few of the Phoenix Frenzy demos(300+ms for every interaction, sometimes 2 entire seconds to add a new row in the tables demo).

2 Likes