Skip to content

Conversation

@mccabe-david
Copy link

Description

I wanted to add a play button in CodeBlock to run the code and update state elsewhere in the app. So, I exposed a new prop to optionally add additional header components in CodeBlock.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Changes Made

Testing

  • All existing tests pass
  • Added new tests for the changes
  • Manually tested the changes

Test Coverage

Screenshots/Demos

Play Button running SQL queries in my app
Screenshot 2026-01-08 at 5 33 08 PM

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have created a changeset (pnpm changeset)

Changeset

  • I have created a changeset for these changes

Additional Notes

This feature could also be added if CodeBlock was exported directly and we added a prop to it.

import { remarkCjkAutolinkBoundary } from "./lib/remark/cjk-autolink";
import { cn } from "./lib/utils";
import packageJson from "./package.json";
import { CodeBlock } from "./lib/code-block";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { CodeBlock } from "./lib/code-block";

Unused CodeBlock import on line 33 should be removed from packages/streamdown/index.tsx

Fix on Vercel

<Code {...props} extraCodeHeader={extraCodeHeader} />
),
...components,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When extraCodeHeader is provided along with a custom code component via the components prop, the custom component overwrites the wrapped version that passes extraCodeHeader through, causing the extraCodeHeader prop to be lost

Fix on Vercel

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