diff --git a/scopes/docs/docs/docs.preview.runtime.tsx b/scopes/docs/docs/docs.preview.runtime.tsx index 108f76f034d6..a07a9a210cc6 100644 --- a/scopes/docs/docs/docs.preview.runtime.tsx +++ b/scopes/docs/docs/docs.preview.runtime.tsx @@ -9,7 +9,7 @@ export type DocsRootProps = { Provider: React.ComponentType | undefined; componentId: string; docs: Docs | undefined; - compositions: any; + compositions?: any; context: RenderingContext; }; @@ -25,10 +25,11 @@ export class DocsPreview { componentId: ComponentID, envId: string, modules: PreviewModule, - [compositions]: [any], + [compositionsFromParams]: [any], context: RenderingContext ) => { const docsModule = this.selectPreviewModel(componentId.fullName, modules); + const compositions = compositionsFromParams || []; const mainModule = modules.modulesMap[envId] || modules.modulesMap.default; let defaultExports = mainModule.default; diff --git a/scopes/html/html/html-docs-app.ts b/scopes/html/html/html-docs-app.ts index 28582db3ea5b..f868eb549165 100644 --- a/scopes/html/html/html-docs-app.ts +++ b/scopes/html/html/html-docs-app.ts @@ -3,7 +3,7 @@ import { DocsRootProps } from '@teambit/docs'; import DocsRoot from '@teambit/react.ui.docs-app'; import { htmlToReact } from './html-to-react'; -const htmlDocsRoot = function ({ compositions, ...rest }: DocsRootProps) { +const htmlDocsRoot = function ({ compositions = {}, ...rest }: DocsRootProps) { // should be mapObject, Record any>> // @ts-ignore TODO fix const reactCompositions = mapObject(compositions, (key, value) => [key, htmlToReact(value as HTMLElement)]);