←back to thread

188 points taddgiles | 7 comments | | HN request time: 0s | source | bottom
1. recroad ◴[] No.45310580[source]
Elixir is fantastic. Liveview is a huge productivity multiplier - lot of boilerplate disappears.
replies(1): >>45311153 #
2. andrewflnr ◴[] No.45311153[source]
LiveView is fun, but my problem is that in practice I often want local-first state. Is there a good way to do that with LiveView, maybe a clean way to write the little javascript snippets so they work with local state?
replies(5): >>45311296 #>>45311461 #>>45312757 #>>45312810 #>>45313152 #
3. ipnon ◴[] No.45311296[source]
LiveView already has local first state. The magic in LiveView is how it uses WebSocket connections to the client to keep the client state in sync with the server state. This is why you just need to update the socket and the rest just works.

If you want to have some state that only exists on the server, then you simply don’t assign that data to the socket.

4. arcanemachiner ◴[] No.45311461[source]
Alpine.js is a good tool for this, but it can have issues when LV updates the DOM.
5. mau013 ◴[] No.45312757[source]
Checkout Hologram. It aims at client based state (but it’s all Elixir as it transpiles the Hologram pieces to JS).
6. SJMG ◴[] No.45312810[source]
LiveSvelte or LiveVue have some impressive demos. I've never used them though.
7. jamauro ◴[] No.45313152[source]
You can take a look at JS commands and hooks. Ultimately I came to the determination that while LiveView is cool, I think I want the opposite. I’m hoping Hologram will be the answer.