diff --git a/.core/app/shell.js b/.core/app/shell.js index 193d334..bc64292 100644 --- a/.core/app/shell.js +++ b/.core/app/shell.js @@ -1,8 +1,14 @@ -export const Shell = async () => { +export const Shell = async LoadingComponent => { const { default: React, useRef } = await import('react'); const { default: _ } = await import('underscore'); const { createRoot } = await import('react-dom/client'); - const { Loading } = await import('../components/Loading'); + + let Loading; + if (LoadingComponent) Loading = LoadingComponent; + else { + const mod = await import('../components/Loading'); + Loading = mod.Loading; + } const Shell = () => { window.LoadingRef = useRef(); @@ -16,5 +22,10 @@ export const Shell = async () => { const { App } = await import('./index'); await App(); - _.defer(() => window.LoadingRef.current.setVisible(false)); + _.defer( + () => + window.LoadingRef.current && + _.isFunction(window.LoadingRef.current.setVisible) && + window.LoadingRef.current.setVisible(false), + ); };