Skip to content

fix(web-client): remove TypeScript cast leak that broke UI runtime - #685

Merged
sonichi merged 1 commit into
mainfrom
fix/web-client-ts-cast-leak
May 14, 2026
Merged

sonichi merged 1 commit into
mainfrom
fix/web-client-ts-cast-leak

Conversation

@sonichi

@sonichi sonichi commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • void (el as HTMLElement).offsetWidth from PR feat(task-expand): 1s yellow flash on expand:N target (visible feedback) #684 sat inside an inline-JS template-string. The as HTMLElement cast leaked unchanged to the browser, causing Uncaught SyntaxError: Unexpected identifier 'as' and breaking the whole web UI.
  • Drop the cast — querySelectorAll's HTMLElement typing at runtime makes it redundant anyway.

Self-verification

  • Edited file → launchctl kickstart -k gui/$(id -u)/com.sutando.web-client (PID 73145)
  • Chrome MCP: navigated to http://localhost:8080/, document.querySelectorAll('.task-item').length === 30, typeof renderTasks === 'function', console clean.

Test plan

  • Hard-refresh web UI; check Console for Unexpected identifier 'as' — should be gone
  • Tasks list renders (was failing because the parse error halted script execution)

🤖 Generated with Claude Code

`void (el as HTMLElement).offsetWidth` was inside an inline-JS
string-literal that's served verbatim to the browser, never compiled
through tsc. The `as HTMLElement` cast leaked through and produced
`Uncaught SyntaxError: Unexpected identifier 'as'` at runtime,
breaking the entire web UI.

At runtime querySelectorAll returns HTMLElement-typed nodes
implicitly, so the cast is unnecessary — just drop it.

Per feedback_inline_js_escaping.md: inline-JS in web-client.ts
template strings is NOT TypeScript, validate as plain JS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonichi
sonichi merged commit aa2c135 into main May 14, 2026
1 check passed
@sonichi
sonichi deleted the fix/web-client-ts-cast-leak branch May 14, 2026 03:07
liususan091219 pushed a commit to liususan091219/sutando-fork that referenced this pull request May 28, 2026
`void (el as HTMLElement).offsetWidth` was inside an inline-JS
string-literal that's served verbatim to the browser, never compiled
through tsc. The `as HTMLElement` cast leaked through and produced
`Uncaught SyntaxError: Unexpected identifier 'as'` at runtime,
breaking the entire web UI.

At runtime querySelectorAll returns HTMLElement-typed nodes
implicitly, so the cast is unnecessary — just drop it.

Per feedback_inline_js_escaping.md: inline-JS in web-client.ts
template strings is NOT TypeScript, validate as plain JS.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant