Phoenix liveView 0.9.1 breaking changes

March 16, 2020

If you updated your mix dependencies to use {:phoenix_live_view, “~> 0.9.0”} you might be surprised that …the web socket connection is gone. It’s due to backwards incompatible changes: “LiveView no longer uses the default app layout” which basically means you your liveView redendered template is no longer wrapped by the default layout which (in most cases) includes app.js that makes a connection to live web socket.

what’s the fix?

The fix is very simple. Open your router.ex and udpate paths to your /live routes to include layout.
For instance:


# lib/example_web/router.ex

    live "/example", MyExample


# lib/example_web/router.ex

    live "/example", MyExample, layout: {ExampleWeb.LayoutView, :app}

If you don’t know what’s your layout, open views/layout_view.ex and check the name after defmodule.

That’s it!