News for hackers. Stuff that matters.
Re:LiveView Is Best with Svelte by debussyman on Wednesday April 03, 2024 @11:08AM (#39918475)
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 by logicallee on Wednesday April 03, 2024 @11:45AM (#39918969)
How usable are LiveView pages while offline? (Due to intermittent lack of network connectivity.)
Re:LiveView Is Best with Svelte by realusername on Wednesday April 03, 2024 @12:30PM (#39919503)
It's the same as any other web page, it doesn't work when you receive or send data from the server.

Liveview isn't that special, the liveview paradigm works best for what would already be online actions in a normal page.

Re:LiveView Is Best with Svelte by victorbjorklund on Wednesday April 03, 2024 @11:47AM (#39918987)
Liveview does not work at all while offline. If you just experience a short temporary drop it can reconnect you automatically.
Re:LiveView Is Best with Svelte by POiNTx on Wednesday April 03, 2024 @11:56AM (#39919087)
Out of the box, they don't work offline. But there's recently been a project showing it's possible to create a PWA with CRDT's and LiveSvelte:

https://github.com/tonydangblog/liveview-svelte-pwa

Re:LiveView Is Best with Svelte by matlin on Wednesday April 03, 2024 @01:06PM (#39920034)
Mobile networks in general also produce a lot of latency and often warrants a local first caching system on the client. If you want a LiveView like user experience but resilience to flaky network conditions, we just added Svelte 5 bindings to Triplit[1] which let's you write queries client-side and have them sync with a server over web-sockets. Probably not attractive to Elixir devs but if Svelte is your central focus, Triplit is a good option.

[1] https://www.triplit.dev/docs/frameworks/svelte