Concrete examples of when to use live_patch, live_redirect, push_redirect, push_patch?

Notably, I’ve largely ditched the traditional view structure used by Phoenix controllers / views / templates in favor of:

my_app_web/
  pages/
    shipments/
      show/
        show.html.leex # the template
        show.ex # the live view
        data.ex # a data fetching helper
        view_helper.ex # the normal phoenix view helper
        components/ # components relevant only to this page
          ...

It makes this whole process way easier. I don’t really like Live in the module name anyway, it holds not a lot of value. The shipment show module name would be MyAppWeb.Pages.Shipments.Show, so it gets named just like any other Elixir module. All the files for a page are all in one nice spot, and you can make a new page by just copying and pasting any existing page folder.

7 Likes