|
|
|
|
|
by benmmurphy
501 days ago
|
|
phoenix live view is effectively built around the assumption that the server process never dies and never restarts. its a very dubious model for a production deployment. > what happens when the server restarts / connection is lost / server dies? > you lose all of the current client state but you can work around this by persisting all the client state somewhere. > oh, so why am i using live view again? |
|
Not exactly, it's built to hold state in memory by default but doesn't assume how you want to handle deploys or server restarts. There's a built in restore mechanism for forms and it's trivial to shuffle state off to either the client/redis/your db[1]. You'd have the same problem if you were storing all your state in memory for any web application regardless of your library choice. Or you conversely have the problem that refreshing the page trashes client state.
So there are two thinks here, you don't have to use live_view to use elixir or phoenix, and if you do you just need to actually think about how you're solving problems. The state can get trashed anywhere for any number of reasons. Tossing on the client and forgetting about it just moves the problem.
[1] https://hexdocs.pm/phoenix_live_view/deployments.html