diff --git a/code/lib/preview-web/src/render/StoryRender.test.ts b/code/lib/preview-web/src/render/StoryRender.test.ts index e80c076e42d..24392522ea7 100644 --- a/code/lib/preview-web/src/render/StoryRender.test.ts +++ b/code/lib/preview-web/src/render/StoryRender.test.ts @@ -51,7 +51,7 @@ describe('StoryRender', () => { await expect(preparePromise).rejects.toThrowError(PREPARE_ABORTED); }); - it('does run play function if passed runPlayFunction=true', async () => { + it('does run play function if passed autoplay=true', async () => { const story = { id: 'id', title: 'title', @@ -69,7 +69,7 @@ describe('StoryRender', () => { {} as any, entry.id, 'story', - { runPlayFunction: true }, + { autoplay: true }, story as any ); @@ -77,7 +77,7 @@ describe('StoryRender', () => { expect(story.playFunction).toHaveBeenCalled(); }); - it('does not run play function if passed runPlayFunction=false', async () => { + it('does not run play function if passed autoplay=false', async () => { const story = { id: 'id', title: 'title', @@ -95,7 +95,7 @@ describe('StoryRender', () => { {} as any, entry.id, 'story', - { runPlayFunction: false }, + { autoplay: false }, story as any ); diff --git a/code/lib/preview-web/src/render/StoryRender.ts b/code/lib/preview-web/src/render/StoryRender.ts index f4c6e4a3737..9e6f9351a82 100644 --- a/code/lib/preview-web/src/render/StoryRender.ts +++ b/code/lib/preview-web/src/render/StoryRender.ts @@ -47,7 +47,7 @@ export type RenderContextCallbacks = Pick< >; export type StoryRenderOptions = { - runPlayFunction?: boolean; + autoplay?: boolean; }; export class StoryRender implements Render { @@ -76,7 +76,7 @@ export class StoryRender implements Render, public id: StoryId, public viewMode: ViewMode, - public renderOptions: StoryRenderOptions = { runPlayFunction: true }, + public renderOptions: StoryRenderOptions = { autoplay: true }, story?: Store_Story ) { this.abortController = new AbortController(); @@ -223,12 +223,7 @@ export class StoryRender implements Render { diff --git a/code/ui/blocks/src/blocks/Story.tsx b/code/ui/blocks/src/blocks/Story.tsx index 328e0325aae..d373dd195a8 100644 --- a/code/ui/blocks/src/blocks/Story.tsx +++ b/code/ui/blocks/src/blocks/Story.tsx @@ -97,8 +97,8 @@ const Story: FC = (props) => { let cleanup: () => void; if (story && storyRef.current) { const element = storyRef.current as HTMLElement; - const runPlayFunction = story.parameters.docs?.autoplay; - cleanup = context.renderStoryToElement(story, element, { runPlayFunction }); + const autoplay = story.parameters.docs?.autoplay; + cleanup = context.renderStoryToElement(story, element, { autoplay }); setShowLoader(false); } return () => cleanup && cleanup();