Phoenix + LV website keeps auto-refreshing in production

I can check more on this later today when I sit down to work, sorry just taking glances on my phone at the moment. :blush:

Update
Okay, I updated the csp and I haven’t been able to reproduce the reload anymore, both in production and in development. So, I’m not sure if the csp lacking the manifest-src was causing the issue for Brave or not, but it appears to be fixed.

I’m thinking that when I checked earlier on my phone, there may have been an internet connection issue that caused the socket to reload as it was disconnected during that brief blip in service (that’s my guess currently).

I tested with Firefox and Brave in production and development. Could it be that the person reporting the errors across browsers has spotty internet service?

Also, if it has to do with form recovery, then you can try checking this out from the docs:

Note: if you want to see form recovery working in development, please make sure to disable live reloading in development by commenting out the LiveReload plug in your endpoint.ex file or by setting code_reloader: false in your config/dev.exs. Otherwise live reloading may cause the current page to be reloaded whenever you restart the server, which will discard all form state.

Have you seen this thread on Brave and WebSockets? It’s not the exact case you’re experiencing but Chris McCord mentions:

If you are able to reliably recreate, you could try instantiating the liveSocket and liveSocket.connect inside a window.addEventListender("DOMContentLoaded", ...)

Not sure if that will help or not.

1 Like