From ba4709f2988d506215b5ba415701dcc800a3d901 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Wed, 20 Oct 2021 21:37:14 +1100 Subject: [PATCH] Cleanup `PreviewWeb` a little --- lib/preview-web/src/PreviewWeb.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/preview-web/src/PreviewWeb.tsx b/lib/preview-web/src/PreviewWeb.tsx index 4532ee6d5ad..0b79e567301 100644 --- a/lib/preview-web/src/PreviewWeb.tsx +++ b/lib/preview-web/src/PreviewWeb.tsx @@ -323,11 +323,11 @@ export class PreviewWeb { return; } - const storyChanged = this.previousSelection?.storyId !== selection.storyId; + const storyIdChanged = this.previousSelection?.storyId !== selection.storyId; const viewModeChanged = this.previousSelection?.viewMode !== selection.viewMode; const implementationChanged = - !storyChanged && this.previousStory && story !== this.previousStory; + !storyIdChanged && this.previousStory && story !== this.previousStory; if (persistedArgs) { this.storyStore.args.updateFromPersisted(story, persistedArgs); @@ -336,7 +336,7 @@ export class PreviewWeb { } // Don't re-render the story if nothing has changed to justify it - if (this.previousStory && !storyChanged && !implementationChanged && !viewModeChanged) { + if (this.previousStory && !storyIdChanged && !implementationChanged && !viewModeChanged) { this.channel.emit(Events.STORY_UNCHANGED, selection.storyId); return; } @@ -344,7 +344,7 @@ export class PreviewWeb { await this.cleanupPreviousRender({ unmountDocs: viewModeChanged }); // If we are rendering something new (as opposed to re-rendering the same or first story), emit - if (this.previousSelection && (storyChanged || viewModeChanged)) { + if (this.previousSelection && (storyIdChanged || viewModeChanged)) { this.channel.emit(Events.STORY_CHANGED, selection.storyId); } @@ -508,17 +508,6 @@ export class PreviewWeb { if (initial) { const storyContext = this.storyStore.getStoryContext(story); - const { parameters, initialArgs, argTypes, args } = storyContext; - if (FEATURES?.storyStoreV7) { - this.channel.emit(Events.STORY_PREPARED, { - id, - parameters, - initialArgs, - argTypes, - args, - }); - } - try { await runPhase('loading', async () => { loadedContext = await applyLoaders({