diff --git a/lib/preview-web/src/PreviewWeb.test.ts b/lib/preview-web/src/PreviewWeb.test.ts index 0474e446f835..ac18a122a429 100644 --- a/lib/preview-web/src/PreviewWeb.test.ts +++ b/lib/preview-web/src/PreviewWeb.test.ts @@ -85,7 +85,7 @@ jest.mock('react-dom'); jest.mock('./WebView'); const serializeError = (error: Error) => { - const { name, message, stack } = error; + const { name = 'Error', message = String(error), stack } = error; return { name, message, stack }; }; diff --git a/lib/preview-web/src/StoryRender.ts b/lib/preview-web/src/StoryRender.ts index 0cf6ae56394d..e49e89903abf 100644 --- a/lib/preview-web/src/StoryRender.ts +++ b/lib/preview-web/src/StoryRender.ts @@ -236,9 +236,10 @@ export class StoryRender implements Render {}); }); this.notYetRendered = false; - if (abortSignal.aborted || this.phase !== 'rendering') return; + if (abortSignal.aborted) return; - if (forceRemount && playFunction) { + // The phase should be 'rendering' but it might be set to 'aborted' by another render cycle + if (forceRemount && playFunction && this.phase !== 'errored') { this.disableKeyListeners = true; try { await this.runPhase(abortSignal, 'playing', async () => {