ReviewOS

stacks/stx

Any '>' inside an @-handler attribute silently kills the handler (arrows, comparisons, ternaries)

#1771
Closed glennmichael123 opened this 10 days ago · {{ comments.length }} {{ comments.length === 1 ? 'comment' : 'comments' }}
10 days ago

Minimal repro (verified on main @ da91c34 via bun-plugin-stx/serve + WebView click-through)

<script client>
const flag1 = state(false); const flag2 = state(false)
const flag3 = state(false); const flag4 = state(false)
const count = state(5)
function toggle3() { flag3.set(true) }
function setIf(v) { flag4.set(v) }
</script>
<button @click="flag1.update(v => !v)">arrow</button>       <!-- ❌ never fires -->
<button @click="flag2.set(count() > 0)">bare-gt</button>     <!-- ❌ never fires -->
<button @click="toggle3()">plain</button>                    <!-- ✅ works -->
<button @click="setIf(count() > 3 ? true : false)">tern</button> <!-- ❌ never fires -->

Clicking each and reading bound state: only the plain call fires. No error, no console output — the handler is silently absent.

Notably x-show="list().length > 0" works fine everywhere, so general attribute parsing handles quoted > — the truncation/parse failure is specific to the event-handler (@-attribute) extraction path.

Impact

Real handlers die invisibly: this broke ts-analytics' header menu (@click="open.update(v => !v)") and its GoalRow Edit/Delete buttons (@click="(e) => dispatch('edit', e)") — third member of the silent-template-failure family alongside #1769.

Ask

Either support > inside quoted @-handler values (match the x-show parser), or fail LOUDLY at template-parse time: [stx] file.stx:43 — @click handler truncated at '>'; wrap the expression in a named function.

Sign in to comment on this issue.