Unknown components throw instead of rendering error box

render-dom-unknown-component now calls (error ...) instead of
creating a styled div. This lets tryEvalContent catch the error
and fall back to server fetch, instead of rendering "Unknown
component: ~name" into the page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 22:12:59 +00:00
parent b98a8f8c41
commit bcb58d340f
2 changed files with 3 additions and 12 deletions

View File

@@ -14,7 +14,7 @@
// =========================================================================
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
var SX_VERSION = "2026-03-06T22:10:27Z";
var SX_VERSION = "2026-03-06T22:12:53Z";
function isNil(x) { return x === NIL || x === null || x === undefined; }
function isSxTruthy(x) { return x !== false && !isNil(x); }
@@ -1350,12 +1350,7 @@ continue; } else { return NIL; } } };
})(); };
// render-dom-unknown-component
var renderDomUnknownComponent = function(name) { return (function() {
var el = domCreateElement("div", NIL);
domSetAttr(el, "style", "background:#fef2f2;border:1px solid #fca5a5;color:#991b1b;padding:4px 8px;margin:2px;border-radius:4px;font-size:12px;font-family:monospace");
domAppend(el, createTextNode((String("Unknown component: ") + String(name))));
return el;
})(); };
var renderDomUnknownComponent = function(name) { return error((String("Unknown component: ") + String(name))); };
// RENDER_DOM_FORMS
var RENDER_DOM_FORMS = ["if", "when", "cond", "case", "let", "let*", "begin", "do", "define", "defcomp", "defmacro", "defstyle", "defkeyframes", "defhandler", "map", "map-indexed", "filter", "for-each"];

View File

@@ -286,11 +286,7 @@
(define render-dom-unknown-component
(fn (name)
(let ((el (dom-create-element "div" nil)))
(dom-set-attr el "style"
"background:#fef2f2;border:1px solid #fca5a5;color:#991b1b;padding:4px 8px;margin:2px;border-radius:4px;font-size:12px;font-family:monospace")
(dom-append el (create-text-node (str "Unknown component: " name)))
el)))
(error (str "Unknown component: " name))))
;; --------------------------------------------------------------------------