Skip to content

fix(ui): guard registerOpenCodeTheme against duplicate registration - #20

Merged
Rwanbt merged 1 commit into
devfrom
fix/theme-registration-idempotency
Jul 30, 2026
Merged

fix(ui): guard registerOpenCodeTheme against duplicate registration#20
Rwanbt merged 1 commit into
devfrom
fix/theme-registration-idempotency

Conversation

@Rwanbt

@Rwanbt Rwanbt commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

registerOpenCodeTheme() is called from both context/marked.tsx and the Shiki worker pool (worker.ts) to guarantee the theme is registered before either needs it. Without a guard, both call sites re-running registerCustomTheme repeatedly is harmless but wasteful — this adds a module-level flag so it only registers once.

How did you verify your code works?

Small, self-contained change; verified bun run typecheck stays clean on packages/ui.

Screenshots / recordings

Not applicable — internal idempotency guard, no visible behavior change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Called from both context/marked.tsx and the Shiki worker pool (worker.ts)
to guarantee the theme is registered before either needs it. Without the
guard, both call sites re-running registerCustomTheme repeatedly is
harmless but wasteful.
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot closed this Jul 30, 2026
@Rwanbt Rwanbt reopened this Jul 30, 2026
@Rwanbt
Rwanbt merged commit 7a50955 into dev Jul 30, 2026
21 of 28 checks passed
@Rwanbt
Rwanbt deleted the fix/theme-registration-idempotency branch July 30, 2026 07:53
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.

1 participant