ReviewOS

stacks/stx

Debug `console.log` shipped in dist: `:class` binding logs on every element

#1786
Closed glennmichael123 opened this 14 days ago · 0 comments
14 days ago

@class / :class / x-class bindings emit a debug console.log on every element they bind. This ships in dist, so it fires in production for end users.

Location

dist/signals.js:1802-1806 (v0.2.113)

else if (name === '@class' || name === ':class' || name === 'x-class') {
  console.log('[stx] HIT x-class handler:', el.tagName);
  bindClass(el, value, scope);
  el.removeAttribute(name);
}

None of the sibling handlers (@style/:style/x-style immediately below, @show, @text, @model, …) log anything, so this looks like a leftover debug line rather than intentional instrumentation.

Reproduce

bun add @stacksjs/stx@0.2.113

Render any template containing a class binding and open the console:

<div :class="{ active: isActive() }">hi</div>

Console shows [stx] HIT x-class handler: DIV — once per bound element, on every hydration.

Impact

Minor but user-visible. It's noise in consumers' production consoles, it scales with the number of class-bound elements on a page, and it makes :class the one binding you avoid when console output matters (log-forwarding, error-tracking breadcrumbs, Playwright/Puppeteer runs that assert on console).

Suggested fix

Delete the line, or gate it behind whatever debug flag the rest of the codebase uses.

Environment

  • @stacksjs/stx 0.2.113
  • Found while auditing directive support in the shipped runtime for a template migration.

Sign in to comment on this issue.