Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/fix-shiki-theme-priority.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"streamdown": patch
---

Fix: `shikiTheme` prop priority chain is now fully reachable.

Previously, `shikiTheme` had a default value in the props destructuring (`= defaultShikiTheme`), making the `plugins?.code?.getThemes()` fallback unreachable in both orderings. The fix removes the destructuring default and moves it to the end of the nullish coalescing chain, so all three levels are reachable:

1. Explicit `shikiTheme` prop (highest priority)
2. Code plugin's `getThemes()` (second priority)
3. Built-in `defaultShikiTheme` (final fallback)
5 changes: 3 additions & 2 deletions packages/streamdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export const Streamdown = memo(
rehypePlugins = defaultRehypePluginsArray,
remarkPlugins = defaultRemarkPluginsArray,
className,
shikiTheme = defaultShikiTheme,
shikiTheme,
mermaid,
controls = true,
isAnimating = false,
Expand Down Expand Up @@ -609,7 +609,8 @@ export const Streamdown = memo(
// Combined context value - single object reduces React tree overhead
const contextValue = useMemo<StreamdownContextType>(
() => ({
shikiTheme: plugins?.code?.getThemes() ?? shikiTheme,
shikiTheme:
shikiTheme ?? plugins?.code?.getThemes() ?? defaultShikiTheme,
controls,
isAnimating,
lineNumbers,
Expand Down
Loading