Can't pass new root layout to live macro in router

I’m on LiveView v0.16.0 and trying to use an alternate root layout.

The docs say:

live "/dashboard", MyAppWeb.Dashboard, layout: {MyAppWeb.LayoutView, :root}

My code is:

live "/someurl", MyAppWeb.MyLive, layout: {MyAppWeb.LayoutView, :root2}

The error I get is:

** (ArgumentError) unknown live option :layout.

Supported options include: :container, :as, :metadata, :private.

Looks like that option is no longer applicable directly to live/4

It’s now used from live_session/2 as :root_layout but unfortunately the docs were not updated correctly, it’s a pending commit that should be live in v0.16.1

See Breaking changes for layout option in Phoenix.LiveView.Router.live/4 · Issue #1565
and Remove live layout option from docs by matthewlehner · Pull Request #1566

2 Likes