From 565304c8d7d34aed35c9ad2bb7e0136cd1676a12 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 20 Jun 2022 14:19:24 +0200 Subject: [PATCH] Reset instrumenter state on HMR --- lib/instrumenter/src/instrumenter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/instrumenter/src/instrumenter.ts b/lib/instrumenter/src/instrumenter.ts index 4b8253cd3548..86b5f64cc4b1 100644 --- a/lib/instrumenter/src/instrumenter.ts +++ b/lib/instrumenter/src/instrumenter.ts @@ -133,6 +133,9 @@ export class Instrumenter { this.channel.on(STORY_RENDER_PHASE_CHANGED, ({ storyId, newPhase }) => { const { isDebugging } = this.getState(storyId); this.setState(storyId, { renderPhase: newPhase }); + if (newPhase === 'preparing' && isDebugging) { + resetState({ storyId }); + } if (newPhase === 'playing') { resetState({ storyId, isDebugging }); }