From ab6dd53be1873b1f9e0c4ffc52327994da78d13b Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 21 Jun 2022 13:19:07 +1000 Subject: [PATCH] We need a little bit of async in core-client. cc @ndelangen - composition was broken after remove the `importPolyfills().then` from here. --- lib/core-client/src/manager/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/core-client/src/manager/index.ts b/lib/core-client/src/manager/index.ts index 45f7a9f8098b..8a31a2a5a0d6 100644 --- a/lib/core-client/src/manager/index.ts +++ b/lib/core-client/src/manager/index.ts @@ -5,5 +5,9 @@ import Provider from './provider'; const { document } = global; -const rootEl = document.getElementById('root'); -renderStorybookUI(rootEl, new Provider()); +// We need to wait a promise "tick" to allow all subsequent addons etc to execute +// (alternatively, we could ensure this entry point is always loaded last) +Promise.resolve().then(() => { + const rootEl = document.getElementById('root'); + renderStorybookUI(rootEl, new Provider()); +});