Fix client routing: fall through to server on layout/section change
Client-side routing was only swapping #main-panel content without updating OOB headers (nav rows, sub-rows). Now each page entry in the registry includes a layout identity (e.g. "sx-section:Testing") and try-client-route falls through to server when layout changes, so OOB header updates are applied correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -704,6 +704,31 @@ def _build_pages_sx(service: str) -> str:
|
||||
if io_deps else "()"
|
||||
)
|
||||
|
||||
# Extract layout identity for client-side routing.
|
||||
# When layout changes between pages, client routing falls through
|
||||
# to server so OOB header updates are applied.
|
||||
layout_id = ""
|
||||
if isinstance(page_def.layout, str):
|
||||
layout_id = page_def.layout
|
||||
elif isinstance(page_def.layout, list):
|
||||
from .types import Keyword as _Kw, Symbol as _Sym
|
||||
first = page_def.layout[0]
|
||||
if isinstance(first, _Kw):
|
||||
layout_id = first.name
|
||||
elif isinstance(first, _Sym):
|
||||
layout_id = first.name
|
||||
else:
|
||||
layout_id = str(first)
|
||||
# Append section kwarg to distinguish same-layout-type
|
||||
# with different sections (e.g. sx-section+Docs vs sx-section+Testing)
|
||||
raw_layout = page_def.layout
|
||||
for li in range(1, len(raw_layout) - 1):
|
||||
if isinstance(raw_layout[li], _Kw) and raw_layout[li].name == "section":
|
||||
val = raw_layout[li + 1]
|
||||
if val is not None:
|
||||
layout_id = f"{layout_id}:{val}"
|
||||
break
|
||||
|
||||
# Build closure as SX dict
|
||||
closure_parts: list[str] = []
|
||||
for k, v in page_def.closure.items():
|
||||
@@ -719,6 +744,7 @@ def _build_pages_sx(service: str) -> str:
|
||||
+ " :auth " + _sx_literal(auth)
|
||||
+ " :has-data " + has_data
|
||||
+ " :stream " + stream
|
||||
+ " :layout " + _sx_literal(layout_id)
|
||||
+ " :io-deps " + io_deps_sx
|
||||
+ " :content " + _sx_literal(content_src)
|
||||
+ " :deps " + deps_sx
|
||||
|
||||
Reference in New Issue
Block a user