Merge pull request #1017 from buster-so/big-nate-bus-1850-blackbox-message-blow-up

update syntax highlight to force string child
This commit is contained in:
Nate Kelley 2025-09-19 16:51:55 -06:00 committed by GitHub
commit 56ff264abc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -62,7 +62,7 @@ export const SyntaxHighlighter = ({
);
})
) : (
<SyntaxFallback fallbackColor={style.color}>{children}</SyntaxFallback>
<SyntaxFallback fallbackColor={style.color}>{children || ''}</SyntaxFallback>
)}
</SyntaxWrapper>
);
@ -126,10 +126,11 @@ const Line: React.FC<{
Line.displayName = 'Line';
const SyntaxFallback: React.FC<{ children: string; fallbackColor?: string }> = ({
children,
children = '',
fallbackColor = 'inherit',
}) => {
const fallbackChildren: Pick<ThemedToken, 'content' | 'color'>[][] = children
const ensureString = typeof children === 'string' ? children : '';
const fallbackChildren: Pick<ThemedToken, 'content' | 'color'>[][] = (ensureString || '')
.split('\n')
.map((line) => {
return [