From 8268d7a759e53458a677ea8d71cc5de3424cb9dd Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Jul 2020 12:40:33 +0200 Subject: [PATCH 1/2] I don't know what changed, but this seems to fix the issue. Let's discuss! --- lib/core/src/client/preview/loadCsf.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/src/client/preview/loadCsf.ts b/lib/core/src/client/preview/loadCsf.ts index b6637b5893de..8d76f7d335fa 100644 --- a/lib/core/src/client/preview/loadCsf.ts +++ b/lib/core/src/client/preview/loadCsf.ts @@ -230,14 +230,15 @@ export const loadCsf = ({ `Invalid module '${m}'. Did you forget to pass \`module\` as the second argument to \`configure\`"?` ); } + if (m && m.hot && m.hot.dispose) { ({ previousExports = new Map() } = m.hot.data || {}); - m.hot.dispose((data) => { loaded = false; // eslint-disable-next-line no-param-reassign data.previousExports = previousExports; }); + m.hot.accept(); } if (loaded) { logger.warn('Unexpected loaded state. Did you call `load` twice?'); From 56a7a9d31d69fe3a7de6750522e059e106c22e2c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 28 Jul 2020 17:00:50 +0200 Subject: [PATCH 2/2] FIX tests --- lib/core/src/client/preview/loadCsf.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/src/client/preview/loadCsf.test.ts b/lib/core/src/client/preview/loadCsf.test.ts index 81889823b1ed..281ed808dcca 100644 --- a/lib/core/src/client/preview/loadCsf.test.ts +++ b/lib/core/src/client/preview/loadCsf.test.ts @@ -16,6 +16,7 @@ beforeEach(() => { hot: { data: {}, dispose: (cb: (data: any) => void) => cbs.push(cb), + accept: jest.fn(), }, } as unknown) as NodeModule; });