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?
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.
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.