From 527c4186ee1605d35941e115b422dd95d0984b16 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 4 Mar 2026 15:48:57 +0000 Subject: [PATCH] Fix _aser_component: evaluate kwargs with _aser not async_eval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _aser_component expands component bodies in SX wire format mode, but was evaluating kwarg values with async_eval (HTML mode). This caused SxExpr kwargs to be fully rendered to HTML strings, which then broke when serialized back to SX — producing bare symbols like 'div' that the client couldn't resolve. Fix: use _aser() for kwarg evaluation to keep values in SX format. Co-Authored-By: Claude Opus 4.6 --- shared/static/scripts/sx.js | 3 --- shared/sx/async_eval.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/shared/static/scripts/sx.js b/shared/static/scripts/sx.js index d756540..f3c1bd6 100644 --- a/shared/static/scripts/sx.js +++ b/shared/static/scripts/sx.js @@ -418,9 +418,6 @@ if (name === "true") return true; if (name === "false") return false; if (name === "nil") return NIL; - // Debug: log env keys to help diagnose - var envKeys = Object.keys(env).filter(function(k) { return typeof env[k] !== "function"; }).slice(0, 20); - console.error("Undefined symbol: " + name + " | env keys (non-fn): " + envKeys.join(", ")); throw new Error("Undefined symbol: " + name); } diff --git a/shared/sx/async_eval.py b/shared/sx/async_eval.py index 891f353..ee8f4a8 100644 --- a/shared/sx/async_eval.py +++ b/shared/sx/async_eval.py @@ -1102,7 +1102,7 @@ async def _aser_component( while i < len(args): arg = args[i] if isinstance(arg, Keyword) and i + 1 < len(args): - kwargs[arg.name] = await async_eval(args[i + 1], env, ctx) + kwargs[arg.name] = await _aser(args[i + 1], env, ctx) i += 2 else: children.append(arg)