Live data from Hacker News

Phoenix 1.7 is View-less

germanvelasco.com

11–20 of 224 posts

Re: Phoenix 1.7 is View-less

#11

I'm building a startup in my free hours using Phoenix Liveview. I can ship features in hours vs days thanks to the simplicity liveview gives me. ZERO react/JS nonsense. I back to writing server side rendered templates with for-free reactivity. Give it a try it's very productive

The downside as I understand it is the extra work to manage UX for connections with high latency and/or going offline, correct?

Re: Phoenix 1.7 is View-less

#12

Speaking as an amateur programmer, is this like Laravel's livewire or intertiajs with inline blade component? (but in Elixir). Or is this something else?

Yes, there are a lot of similarities. As mentioned in siblings, Livewire was inspired by LiveView so they are directly related.

Re: Phoenix 1.7 is View-less

#13
post #7

This makes sense to me. Views always seemed a like unnecessary boilerplate to me. Better to keep all the code together in one module, and just import common functions. On the other hand, I don't typically like defining the template in a sigil, unless it's a really small one, so I probably won't do that much.

I agree in the case of HTML rendering, but I write a lot of JSON APIs and putting the JSON definition in the View has been very pleasant. It didn't say in OP, but how does this change an API? Maybe a `GreetJSON` instead of `GreetHTML`?

Yes, exactly like that.

Re: Phoenix 1.7 is View-less

#14

I'm building a startup in my free hours using Phoenix Liveview. I can ship features in hours vs days thanks to the simplicity liveview gives me. ZERO react/JS nonsense. I back to writing server side rendered templates with for-free reactivity. Give it a try it's very productive

The downside as I understand it is the extra work to manage UX for connections with high latency and/or going offline, correct?

Yes, the downside is basically offline. When offline the LiveView app doesn't work because it can't update it's DOM. A decent solution I've enjoyed is using Alpine.js. It fits very neatly into the LiveView philosophy and can do nearly all UI updating easily. It still minimizes the amount of JS you have to write but you get good client-side update behavior.

High latency isn't an issue if you do it correctly by using the loading classes and what not so that the user knows they are waiting for some data to load. It's pretty much identical to a typical React SPA that has to show loading indicators while waiting for a JSON call to complete.

Re: Phoenix 1.7 is View-less

#15
Hex Docs for Phoenix.View mention the change: https://hexdocs.pm/phoenix_view/Phoenix.View.html#module-mig...

Phoenix.View is replaced by Phoenix.Component:

> With Phoenix.LiveView, Phoenix.View has been replaced by Phoenix.Component. Phoenix.Component is capable of embedding templates on disk as functions components, using the embed_templates function.

More on hexdocs.

Re: Phoenix 1.7 is View-less

#17
post #9

People using Phoenix Liveview -- how do you serve native apps relying on the same backend?

As it stands you have to write a separate API, though there is work being done on native [0].

Otherwise, part of the initial value-prop of LiveView is that if you don't need multiple frontends and you don't need offline support--which a whole lot of apps don't--then LiveView drastically simplifies your stack while still delivering "SPA-like" speed.

[0] https://native.live/

Re: Phoenix 1.7 is View-less

#19
We're building a startup ( https://www.batteriesincl.com/ ) with Elixir and Phoenix 1.7rc (git master really). It's been amazing; I could not be happier.

- We went hard on components and it's made building UI's easy. In fact I wrote a test library to make component testing easier.

- Live view is so easy with a good component library. I'm not a designer, but with snappy interactions and easy to use components, it's not hard to get something that's exciting.

- Elixir is a very nice language to write distributed systems in. Functional in all the right places plus it has OTP.

- The community is full of very senior people who freely answer your noob questions.

- On-boarding people has gone well. The syntax is friendly enough that experienced engineers grasp the basics, leaving functional programming and OTP left to discover.

Post reply on HN