Skip to content

Commit eff7fdf

Browse files
committed
fix(md-render): use Children.map in pre handler for robustness
1 parent c5e1dc2 commit eff7fdf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,11 @@ function resolveSimFileUrl(src: string | undefined): string | undefined {
485485

486486
const STATIC_MARKDOWN_COMPONENTS = {
487487
pre: ({ children }: { children?: React.ReactNode }) => (
488-
<>{isValidElement(children) ? cloneElement(children, { 'data-block': 'true' }) : children}</>
488+
<>
489+
{Children.map(children, (child) =>
490+
isValidElement(child) ? cloneElement(child, { 'data-block': 'true' }) : child
491+
) ?? children}
492+
</>
489493
),
490494
'mermaid-diagram': ({ definition }: { definition?: string }) => {
491495
const isStreaming = useContext(MermaidStreamingCtx)

0 commit comments

Comments
 (0)