Gilou06

Gilou06

I have started developping with Liveview 0.5.1 and recently switched to 0.10.1
I don’t understand well the changelog :" (…)Therefore, we recommend setting put_root_layout in a pipeline that is exclusive to LiveViews"
I understand that root layout is top-level, shared among live and no-live views. The changelog seems to say that that should no longer be the case. If I put put_root_layout to a LiveView dedicated pipeline, it won’t be set for regular view pipe-lines, meaning regular views won’t have a root layout anymore.
Since I could not make my mind with doc and changelog, I went away and altered my code until it “worked accidentely”.
Please tell me if what I did is correct.

1/I set

plug :put_root_layout, {MsimWeb.LayoutView, :root}
in the main pipeline in router.ex

2/My previously empty root.html.eex now contains whatever was in app.html.eex, and I changed the render… to @inner_content

3/My app.html.eex is now almost empty, it has a one line render…

4/ My previously empty live.html has now few lines about live_flash and is called by altering each liveview file with

use Phoenix.LiveView, layout: {MsimWeb.LayoutView, “live.html”}

Thanks for your help

Showing Posts 1 to 2

sfusato

sfusato

Here’s how phx.gen.live generated templates look like in phoenix master. Your changes are on line with the default setup.

Live Layouts part of the LiveView docs expands on this.

Gilou06

Gilou06 OP

Thank you
I read the Live View doc and used it to make my code work. However, can you explain the apparent contradiction between this doc and the changelog ? The item that bugs me is this recomendation in the changelog about not to use the root layout for all views.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews