diff --git a/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx b/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx index ae0b2c40233e..a55915086532 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx +++ b/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx @@ -98,6 +98,10 @@ function EditorWithHeader() { ); } +// this should rather be a stable function +// see https://github.com/facebook/docusaurus/issues/9630#issuecomment-1855682643 +const DEFAULT_TRANSFORM_CODE = (code: string) => `${code};`; + export default function Playground({ children, transformCode, @@ -118,7 +122,7 @@ export default function Playground({ `${code};`)} + transformCode={transformCode ?? DEFAULT_TRANSFORM_CODE} theme={prismTheme} {...props}> {playgroundPosition === 'top' ? (