From acde8745e9a77e91fafe54e2342b0d5f9292f2db Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 17 Mar 2022 22:46:56 +1100 Subject: [PATCH] Fix binding of the `renderStoryToElement` function passed to `DocsRender` Not sure why it was this way round before? --- lib/preview-web/src/DocsRender.ts | 2 +- lib/preview-web/src/PreviewWeb.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/preview-web/src/DocsRender.ts b/lib/preview-web/src/DocsRender.ts index b000919d9ce7..57f6176cf95e 100644 --- a/lib/preview-web/src/DocsRender.ts +++ b/lib/preview-web/src/DocsRender.ts @@ -43,7 +43,7 @@ export class DocsRender { storyById: (storyId: StoryId) => this.store.storyFromCSFFile({ storyId, csfFile }), componentStories: () => this.store.componentStoriesFromCSFFile({ csfFile }), loadStory: (storyId: StoryId) => this.store.loadStory({ storyId }), - renderStoryToElement: renderStoryToElement.bind(this), + renderStoryToElement, getStoryContext: (renderedStory: Story) => ({ ...this.store.getStoryContext(renderedStory), diff --git a/lib/preview-web/src/PreviewWeb.tsx b/lib/preview-web/src/PreviewWeb.tsx index e7d56f378915..d164eaf63850 100644 --- a/lib/preview-web/src/PreviewWeb.tsx +++ b/lib/preview-web/src/PreviewWeb.tsx @@ -518,7 +518,10 @@ export class PreviewWeb { if (selection.viewMode === 'docs' || parameters.docsOnly) { this.currentRender = storyRender.toDocsRender(); - this.currentRender.renderToElement(this.view.prepareForDocs(), this.renderStoryToElement); + this.currentRender.renderToElement( + this.view.prepareForDocs(), + this.renderStoryToElement.bind(this) + ); } else { this.storyRenders.push(storyRender); this.currentRender.renderToElement(this.view.prepareForStory(storyRender.story));