Fix value-select: return raw option elements instead of component
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled

The ~value-options component wrapped options in a fragment that didn't
render correctly inside a <select> innerHTML swap. Return plain
(option) elements directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 08:54:28 +00:00
parent 3bd4f4b661
commit 4098c32878

View File

@@ -388,17 +388,17 @@ def register(url_prefix: str = "/") -> Blueprint:
@bp.get("/examples/api/values") @bp.get("/examples/api/values")
async def api_values(): async def api_values():
from shared.sx.helpers import sx_response from shared.sx.helpers import sx_response
from sxc.sx_components import _oob_code, _component_source_text, _full_wire_text from sxc.sx_components import _oob_code, _full_wire_text
from content.pages import VALUE_SELECT_DATA from content.pages import VALUE_SELECT_DATA
cat = request.args.get("category", "") cat = request.args.get("category", "")
items = VALUE_SELECT_DATA.get(cat, []) items = VALUE_SELECT_DATA.get(cat, [])
items_sx = " ".join(f'"{i}"' for i in items) options_sx = " ".join(f'(option :value "{i}" "{i}")' for i in items)
sx_src = f'(~value-options :items (list {items_sx}))' if not options_sx:
comp_text = _component_source_text("value-options") options_sx = '(option :value "" "No items")'
wire_text = _full_wire_text(sx_src, "value-options") sx_src = f'(<> {options_sx})'
wire_text = _full_wire_text(sx_src)
oob_wire = _oob_code("values-wire", wire_text) oob_wire = _oob_code("values-wire", wire_text)
oob_comp = _oob_code("values-comp", comp_text) return sx_response(f'(<> {options_sx} {oob_wire})')
return sx_response(f'(<> {sx_src} {oob_wire} {oob_comp})')
# --- Reset on Submit --- # --- Reset on Submit ---