mix phx.gen.live generates LiveView, templates, and context for a resource. The generator creates two LiveViews,
ResourceLive.Index is also used for the
ResourceLive.Show is also used for
edit. All of the forms (
edit) rely on a modal to display to the user. The
update actions are handled in the LiveView as well, but they don’t have routes in the router.
See generated router actions for my
InjuredReserve resource below.
live "/injured_reserves", InjuredReserveLive.Index, :index live "/injured_reserves/new", InjuredReserveLive.Index, :new live "/injured_reserves/:id/edit", InjuredReserveLive.Index, :edit live "/injured_reserves/:id", InjuredReserveLive.Show, :show live "/injured_reserves/:id/show/edit", InjuredReserveLive.Show, :edit
I don’t plan to use a modal in my app. Is the simplest approach to create a LiveView for both the
edit actions (
ResourceLive.Edit) then handle the
update actions in those LiveViews?
Any big downsides or gotchas to this approach?