Fix (not) compilation: use isSxTruthy for NIL-safe negation

NIL is a frozen sentinel object ({_nil:true}) which is truthy in JS.
(not expr) compiled to !expr, so (not nil) returned false instead of
true. Fixed to compile as !isSxTruthy(expr) which correctly handles
NIL. This was preventing client-side routing from activating.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 22:01:39 +00:00
parent 719dfbf732
commit 3b00a7095a
3 changed files with 72 additions and 79 deletions

View File

@@ -581,7 +581,7 @@ class JSEmitter:
if name == "or":
return self._emit_or(expr)
if name == "not":
return f"!{self.emit(expr[1])}"
return f"!isSxTruthy({self.emit(expr[1])})"
if name == "do" or name == "begin":
return self._emit_do(expr)
if name == "list":

View File

@@ -373,12 +373,6 @@
(when listen-target
(dom-add-listener listen-target event-name
(fn (e)
(log-info (str "sx:click"
" c1=" (= event-name "click")
" c2=" (= (get verbInfo "method") "GET")
" c3=" (dom-has-attr? el "href")
" c4=" (not (get mods "delay"))
" href=" (dom-get-attr el "href")))
(let ((should-fire true))
;; Changed modifier: skip if value unchanged
(when (get mods "changed")