Live data from Hacker News

LiveView Is Best with Svelte

blog.sequin.io

31–40 of 158 posts

Re: LiveView Is Best with Svelte

#31
post #23

I guess it's fun to build things, but this mashup is pretty messy. If you like Svelte (I do) you're probably going to find sveltekit to be a lot simpler and more useful.

+1, SPA should only be used as a last resort, not sure why the article compares only to it.

SvelteKit is much simpler and well-documented and addresses the issues mentioned.

Re: LiveView Is Best with Svelte

#32
post #13
post #5

So instead of managing state on the client, you manage state on the client and the server? That doesn't seem like an improvement, even if it saves you from having to build yet another API.

It is just a new generation rediscovering ColdFusion, Web Forms, JSF, PHP, Spring, Rails...

What does php spring and rails have to do with this? I'm confused haha

Re: LiveView Is Best with Svelte

#34
post #5

So instead of managing state on the client, you manage state on the client and the server? That doesn't seem like an improvement, even if it saves you from having to build yet another API.

Eventually, some form of this paradigm is going to win.

In practice, applications need state on both the client and the server. The server needs the authoritative state information (since the client is untrusted), but the client needs to be able to re-render in response to user interaction without a round-trip.

Re: LiveView Is Best with Svelte

#35
I love LiveView + Svelte!

(I gave the talk at ElixirConf 2022 on how to combine them, but the live_svelte contributors have done the work to make it a reality)

IMO there is always a need for client side state, especially for apps with rich UX. I also live in NYC where network connectivity is not a given, especially in transit.

One super powerful feature that the authors don't cover is being able to use Phoenix's pubsub, so that server-side state changes that occur on other servers also get pushed reactively to any client. It's pretty typical to have multiple web servers for handling mid/high levels of traffic.

Re: LiveView Is Best with Svelte

#36
> There is a (literal) speed of light limitation with this approach: your server can only be so close to your users.

The next step is to compile your server to WebAssembly and ship it to your clients. You can then use it to optimistically render responses while waiting for the real server to return.

Sounds a little crazy, but we've actually pulled it off for a project, and its magic.

Re: LiveView Is Best with Svelte

#37
post #36

> There is a (literal) speed of light limitation with this approach: your server can only be so close to your users. The next step is to compile your server to WebAssembly and ship it to your clients. You can then use it to optimistically render responses while waiting for the real server to return. Sounds a little crazy, but we've actually pulled it off for a project, and its magic.

Wow, that sounds cool! Can you share any more details?

Re: LiveView Is Best with Svelte

#38
For someone not in the web dev space, this looks like an interesting way to get started.

If one has Python and Rust experience, what would be a recommended "first principles" path to get started in understanding web development with LiveView and Svelte?

Re: LiveView Is Best with Svelte

#39
post #8

I am not familiar with LiveView, so I'm curious. Looks like it processes UI actions server side. So, are all client interactions sent through the websocket? I remember years/decades ago we used to do that with ASP.NET, where every single component interaction was handled by the server. How is this different / better?

I never used ASP.net so I cannot offer a comparison about what is "better" but your assumption is correct that diffs are through a WS and merged client-side. What this has resulted in is actual order of magnitude of implementation time reduction over the crazier SPA complexity available today. Less time to build, less cost to the company, less bugs in the long run, and a single place to manage and reason about state.…

But isn't there a delay in UI responses because of latency then?

Re: LiveView Is Best with Svelte

#40
post #19
post #10

Generally speaking this is the model I’ve always been wanted to build apps in. Event oriented, bidirectional realtime updates with server, ordered events, local and remote state... I didn’t know about LiveView and never used erlang-family languages, but definitely they’re onto something. The traditional request-response model is many times causing a lot of subtle problems with consistency and staleness. A wishful (pr…

> I hope the next decade will be oriented around integrating stateful message-oriented (reactive?) programming into the mainstream full stack Also known as MVC before Rails decided to redefine the term.

Maybe? Most good ideas have been out there for decades. Getting the execution right is what’s hard.
Post reply on HN