fix editor blocks not syncing on content page navigation
Move maybe_sync_editing_blocks to run after module.handle_params since Content pages (about, delivery, privacy, terms) set @page in handle_params rather than init. Previously editing_blocks would show stale content from the previous page. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f47a4b90c7
commit
4ee097596b
@ -217,9 +217,6 @@ defmodule BerrypodWeb.Shop.Page do
|
|||||||
socket
|
socket
|
||||||
end
|
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)
|
# Scroll to top on navigation (different path, not just query param changes)
|
||||||
socket =
|
socket =
|
||||||
if prev_path && prev_path != current_path do
|
if prev_path && prev_path != current_path do
|
||||||
@ -230,10 +227,17 @@ defmodule BerrypodWeb.Shop.Page do
|
|||||||
|
|
||||||
socket = assign(socket, :_current_path, current_path)
|
socket = assign(socket, :_current_path, current_path)
|
||||||
|
|
||||||
# Always call handle_params for URL changes
|
# Always call handle_params for URL changes - some pages (Content) set @page here
|
||||||
case module.handle_params(params, uri, socket) do
|
socket =
|
||||||
{:noreply, socket} -> {:noreply, socket}
|
case module.handle_params(params, uri, socket) do
|
||||||
end
|
{: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
|
end
|
||||||
|
|
||||||
# If editing and we navigated to a different page, reload editing_blocks
|
# If editing and we navigated to a different page, reload editing_blocks
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user