Skip to content

Commit e61b4d5

Browse files
author
Heiner Pöpping
committed
🐛 Fix error when there is no module context provider
1 parent ded2a26 commit e61b4d5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/host/module/ModuleHost.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ const System: FC<SystemPropTypes> = ({
5353
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl as string, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
5454
if (!globalThis.window) {
5555
const moduleContext = useContext(ModuleContext);
56-
moduleContext[system.scope] ??= {
56+
const info = moduleContext[system.scope] ?? {
5757
url: system.url,
5858
modules: new Set(),
5959
};
60-
moduleContext[system.scope].modules.add(system.module);
60+
info.modules.add(system.module);
61+
moduleContext[system.scope] = info;
6162
}
6263

6364
return (

0 commit comments

Comments
 (0)