LiveView sends endless loop of site reload request when opening bootstrap modal

I observe crazy behavior of my live view when a bootstrap modal is opened “above” it. It always fires phx:disconnected events and probably thereby causes endless reloads of the page in the background. I have tried to reproduce the error in a minimal app but I weren’t successful. My first thought was the liveview and my custom js or bootstrap interfere but I wasn’t able to reproduce that.

Interestingly, even when the modal is closed, the reloads statements do not stop and a browser reload of the page is required for normal behavior.

I don’t believe my code is really helpful here. I just slightly changed/extended the search example from here: https://github.com/chrismccord/phoenix_live_view_example/blob/master/lib/demo_web/live/search_live.ex

Does anyone of you have an idea what could go wrong in my application or how I can find out what is going wrong?

Please make sure you try the latest LV. We patched a bug a week or so ago that caused recursive requests when window.popstate was triggered for a hash anchor. Perhaps this is related if the modal was changing the url hash? After you update mix deps, also make sure to rm -rf assets/node_modules/phoenix_live_view and re-run npm install --prefix assets

3 Likes