Skip to content

[perf] Replace inline styles in CodeOutputPanel with CSS module classes#51

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
perf/code-output-panel-css-classes-dfd66967eb3330fe
Draft

[perf] Replace inline styles in CodeOutputPanel with CSS module classes#51
github-actions[bot] wants to merge 1 commit intomainfrom
perf/code-output-panel-css-classes-dfd66967eb3330fe

Conversation

@github-actions
Copy link

@github-actions github-actions bot commented Mar 2, 2026

Tier 2: Render Performance — Inline Style Elimination

Baseline

CodeOutputPanel.tsx contained 5 static style=\{\{}} objects — none varied at runtime. Each inline style object is allocated fresh on every render, triggering React's style reconciliation on every pass.

Fix

Created CodeOutputPanel.module.css with three classes:

Class Replaces
.container style=\{\{ background: 'var(--bgColor-inset)', padding: 12, borderTop: '1px solid var(--borderColor-muted)' }}
.outputLine style=\{\{ margin: 0, fontFamily: 'var(--fontStack-monospace)' }} (×2)
.errorLine style=\{\{ margin: 0, fontFamily: 'var(--fontStack-monospace)', color: 'var(--fgColor-danger)' }}
Primer fgColor-muted utility style=\{\{ color: 'var(--fgColor-muted)' }} (×2)

CSS classes are defined once at stylesheet parse time; they generate zero JS object allocations per render and are not diffed by React's reconciler on each update.

Result

  • 5 inline style props removed
  • CodeOutputPanel.module.css added (13 lines)
  • No visual or behavioural change

Verification

  • npm run lint — clean
  • npm run build — succeeds, no errors
  • npm test — 933/943 tests pass (10 pre-existing failures in client.test.ts due to missing gh auth token in CI; unrelated to this change)
  • ✅ TypeScript errors in CodeOutputPanel.tsx are all pre-existing environment issues (same pattern in ChallengeSandbox.tsx and others)

Generated by Daily Performance Improver

Extract 5 static inline style objects from CodeOutputPanel.tsx into a
new CodeOutputPanel.module.css. Static styles create new JS objects on
every render; moving them to CSS classes eliminates that allocation and
avoids redundant style recalculations.

Changes:
- Create CodeOutputPanel.module.css with .container, .outputLine,
  .errorLine classes
- Replace container div style prop with styles.container
- Replace output/returnValue <pre> style prop with styles.outputLine
- Replace error <pre> style prop with styles.errorLine
- Replace fgColor-muted span style props with Primer utility class

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Author

github-actions bot commented Mar 2, 2026

Pull request created: #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants