Skip to content

claude-usage: the footer and the histogram render again - #5

Open
mcouzinet wants to merge 1 commit into
fdussert:mainfrom
mcouzinet:claude-usage-esc
Open

mcouzinet wants to merge 1 commit into
fdussert:mainfrom
mcouzinet:claude-usage-esc

Conversation

@mcouzinet

Copy link
Copy Markdown
Contributor

render() in the Claude limits widget escapes its footer with esc(), but the widget defines no esc: the helper is Fremkit.esc, on the bridge. The bare reference throws on every render — once a second from the countdown timer, plus once per answer on claude-usage and claude-account — so everything after that line never reaches the tile: today's tokens, the sessions, the cost, and the hourly histogram under them. The gauges above it are built earlier in the same function, which is why the widget looks quiet rather than broken. On a dashboard with the tile on screen, the console fills with ReferenceError: esc is not defined.

One word to fix. The test is the part worth reviewing: the widget is evaluated for real against stubs, in the style of spotify-widget.test.ts, and asserts what sits after the throwing line — the footer text, its escaping, and the histogram. It fails with ReferenceError on the three cases before the fix.

  • widgets/claude-usage/index.html — parts.map(esc) → parts.map(Fremkit.esc). Fremkit.esc does not use this, so passing it to map by reference is safe.
  • widgets/claude-usage/manifest.json — 1.1.0 → 1.1.1.
  • server/test/claude-usage-widget.test.ts — three cases: the day in the footer, a limit name escaped, the histogram drawn.
  • CHANGELOG.md — one line under Unreleased / Fixed.

pnpm typecheck and pnpm test are green (66 server files / 1351 tests, 30 UI files / 382 tests).

🤖 Generated with Claude Code

`render()` escaped the footer with `esc()`, but the widget defines no
such function: the helper lives on the bridge, as `Fremkit.esc`. So the
reference threw on every render — once a second, plus once per channel
answer — and everything the line stands in front of never reached the
tile: today's tokens, the sessions, the cost, and the hourly histogram
under them. The gauges above it drew, which is why the widget looked
merely quiet rather than broken.

The widget is now evaluated for real in a test, against the stubs the
host provides, so a render that throws fails the suite rather than
leaving half a tile empty.

Co-Authored-By: Claude Opus 5 <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