diff --git a/lib/berrypod_web/live/shop/page.ex b/lib/berrypod_web/live/shop/page.ex index 05e719f..a6397af 100644 --- a/lib/berrypod_web/live/shop/page.ex +++ b/lib/berrypod_web/live/shop/page.ex @@ -217,9 +217,6 @@ defmodule BerrypodWeb.Shop.Page do socket end - # After page init, sync editor state if editing and page changed - socket = maybe_sync_editing_blocks(socket) - # Scroll to top on navigation (different path, not just query param changes) socket = if prev_path && prev_path != current_path do @@ -230,10 +227,17 @@ defmodule BerrypodWeb.Shop.Page do socket = assign(socket, :_current_path, current_path) - # Always call handle_params for URL changes - case module.handle_params(params, uri, socket) do - {:noreply, socket} -> {:noreply, socket} - end + # Always call handle_params for URL changes - some pages (Content) set @page here + socket = + case module.handle_params(params, uri, socket) do + {:noreply, socket} -> socket + end + + # After module.handle_params, sync editor state if editing and page changed. + # Must run after handle_params since Content pages set @page there. + socket = maybe_sync_editing_blocks(socket) + + {:noreply, socket} end # If editing and we navigated to a different page, reload editing_blocks