Is there a good reason not to move the navbar into the app layout in the generated files?

Hi!

I’m spending a lot of time thinking about improvements we could make to the starting point in phoenix.

One thing I’ve realized is putting the navbar with the current user, that gets generated by phx.gen.auth in the root layout is maybe not the best idea. If a LV on the page changes current user, it won’t get live updated cause its in the root and not the app layout.

Is there a good reason not to move it into app layout in the phx.gen.auth generator?

1 Like

I’m assuming it’s because in order for the logged in user to change, you would have to go through a through a controller in order to update the http session which requires a page refresh anyway. That said, I think I’ve moved it in most of my apps.

Off topic: awesome mix release video, btw!

1 Like

Nope, go for it :slight_smile:

We put it there because it’s the lowest common denominator in folks apps that will work. Apps can have different layouts, different markup, etc so it’s not possible for the generator to really know where to inject it so it picks the root layout to give you something to roll with. By all means move it wherever you want. Putting in the LV path for dynamic updates is absolutely fine.

3 Likes

I mean in the generator though, to change it for everyone. I feel like at this point most people are running the generator on new projects that will have app layout. What do you think?

And thank you soda!