Live Reload is not working? A save in VS Code 'resets' the state

Wondering if this is the expected behaviour? I was expecting the live reload to compile without changing the current assigns; without calling ‘mount’ …

I’ve just tried this after creating a new LiveView project with ‘mix new project_name --live --no-ecto’.

Any ideas very would be much appreciated! I’m using Elixir 1.11.4, Phoenix 1.5.8, LiveView 0.15.1

Live reload doesn’t mean that you’ll get everything through socket. It means that page will reload(new get request) automatically if its css/html/js was modified, and that is exactly what happened. Doesn’t matter if it’s liveview page, or regular.

“live reload” name was picked before “liveview” and they are not directly connected :slight_smile:


Thank you! :slight_smile: Yes, that makes sense! So, ‘live reload’ is equivalent to an automatic Ctrl+R browser refresh?

I found that Blazor Server can reload without losing state for certain changes - css or small code changes.

So I was expecting / hoping that Phoenix LiveView is able to do this also; compile the code without losing the state (socket assigns etc).

Especially as I’ve read that Elixir code can be updated or replaced by a completely new version with no downtime.

So wondering if this is may be possible with Phoenix / LiveView?

1 Like

Yeah, it’s like an automated refresh. Why do you need a socket persistence? Live reload is only for development purposes, so, just have lost the state and forget.

1 Like

Because it’s convenient to develop forms which keep their values. For example….


In ClojureScript, Figwheel does this and it’s amazing. Is there anything technical stopping us from building something like a stateful live refresh in Phoenix, or is it just that nobody’s done it yet? If there aren’t technical barriers, does anyone have thoughts on how to go about beginning something like Figwheel for Phoenix and if it would be a good idea?

So I ran across an Oct 2021 blog post with an answer to this by a new mapping company that uses Elixir and Phoenix 1.6 in their core product. They’re using React, and adding the ReactRefreshPlugin to Webpack. So, nice, but not yet quite what @BartOtten was hoping for. Btw I’m really loving LiveView with Phoenix 1.6.

1 Like