diff --git a/code/lib/instrumenter/src/instrumenter.ts b/code/lib/instrumenter/src/instrumenter.ts index db80473af4f..4010e9d2b64 100644 --- a/code/lib/instrumenter/src/instrumenter.ts +++ b/code/lib/instrumenter/src/instrumenter.ts @@ -337,7 +337,7 @@ export class Instrumenter { track(method: string, fn: Function, args: any[], options: Options) { const storyId: StoryId = args?.[0]?.__storyId__ || - global.window.__STORYBOOK_PREVIEW__.selectionStore.selection.storyId; + global.window.__STORYBOOK_PREVIEW__.selectionStore?.selection?.storyId; const { cursor, ancestors } = this.getState(storyId); this.setState(storyId, { cursor: cursor + 1 }); const id = `${ancestors.slice(-1)[0] || storyId} [${cursor}] ${method}`; diff --git a/code/lib/preview-api/src/modules/client-api/ClientApi.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.ts index 368c4838301..c4b41fcc509 100644 --- a/code/lib/preview-api/src/modules/client-api/ClientApi.ts +++ b/code/lib/preview-api/src/modules/client-api/ClientApi.ts @@ -125,6 +125,10 @@ export class ClientApi { private lastFileName = 0; constructor({ storyStore }: { storyStore?: StoryStore } = {}) { + console.log( + 'CLIENT_API_MODULE, you should only see this log, exactly ONCE, in the browser console' + ); + this.facade = new StoryStoreFacade(); this.addons = {}; diff --git a/code/lib/preview-api/src/modules/core-client/start.ts b/code/lib/preview-api/src/modules/core-client/start.ts index ce76a4a5b62..9421e0fa918 100644 --- a/code/lib/preview-api/src/modules/core-client/start.ts +++ b/code/lib/preview-api/src/modules/core-client/start.ts @@ -3,7 +3,7 @@ import { global } from '@storybook/global'; import type { Renderer, ArgsStoryFn, Path, ProjectAnnotations } from '@storybook/types'; import { createChannel } from '@storybook/channel-postmessage'; import { FORCE_RE_RENDER } from '@storybook/core-events'; -import { addons } from '../addons'; +import { addons } from '../../addons'; import { PreviewWeb } from '../../preview-web'; import { ClientApi } from '../../client-api'; diff --git a/code/ui/manager/src/components/preview/preview.tsx b/code/ui/manager/src/components/preview/preview.tsx index a0328b32a32..9d84f7f8fe1 100644 --- a/code/ui/manager/src/components/preview/preview.tsx +++ b/code/ui/manager/src/components/preview/preview.tsx @@ -24,6 +24,8 @@ import { FramesRenderer } from './FramesRenderer'; import type { PreviewProps } from './utils/types'; +const { FEATURES } = global; + const getWrappers = (getFn: API['getElements']) => Object.values(getFn(types.PREVIEW)); const getTabs = (getFn: API['getElements']) => Object.values(getFn(types.TAB)); @@ -70,7 +72,7 @@ const createCanvas = (id: string, baseUrl = 'iframe.html', withLoader = true): A const [progress, setProgress] = useState(undefined); useEffect(() => { - if (global.CONFIG_TYPE === 'DEVELOPMENT') { + if (FEATURES?.storyStoreV7 && global.CONFIG_TYPE === 'DEVELOPMENT') { const channel = addons.getServerChannel(); channel.on(PREVIEW_BUILDER_PROGRESS, (options) => {