Refactored composer component interface to one single $me store
This commit is contained in:
@ -60,20 +60,19 @@
|
||||
subscribeAndMapQueries(component.id, component.data.map);
|
||||
}
|
||||
}
|
||||
|
||||
if (component.children) {
|
||||
component.children.forEach(loadComponentAndInitializeState);
|
||||
}
|
||||
|
||||
// Load component and service
|
||||
const componentName = component.component || 'FallBack';
|
||||
component.me = {
|
||||
getComposerStore(component.id).update((storeValue) => ({
|
||||
...storeValue,
|
||||
id: component.id,
|
||||
do: {
|
||||
core: coreServices,
|
||||
machine: component.machineService || null
|
||||
}
|
||||
};
|
||||
}));
|
||||
|
||||
if (component.children) {
|
||||
component.children.forEach(loadComponentAndInitializeState);
|
||||
}
|
||||
const componentName = component.component || 'FallBack';
|
||||
return await getComponent(componentName);
|
||||
}
|
||||
|
||||
@ -128,12 +127,7 @@
|
||||
style={layoutStyle}
|
||||
>
|
||||
{#await loadComponentAndInitializeState(composer) then Component}
|
||||
<svelte:component
|
||||
this={Component}
|
||||
id={composer.id}
|
||||
data={getComposerStore(composer.id)}
|
||||
me={composer.me}
|
||||
/>
|
||||
<svelte:component this={Component} id={composer.id} me={getComposerStore(composer.id)} />
|
||||
{/await}
|
||||
{#if composer?.children}
|
||||
{#each composer.children as child (child.id)}
|
||||
@ -142,12 +136,7 @@
|
||||
style={`grid-area: ${child.slot}`}
|
||||
>
|
||||
{#await loadComponentAndInitializeState(child) then ChildComponent}
|
||||
<svelte:component
|
||||
this={ChildComponent}
|
||||
id={child.id}
|
||||
data={getComposerStore(child.id)}
|
||||
me={child.me}
|
||||
/>
|
||||
<svelte:component this={ChildComponent} id={child.id} me={getComposerStore(child.id)} />
|
||||
{#if child.children && child.children.length}
|
||||
<Composer composer={child} />
|
||||
{/if}
|
||||
|
Reference in New Issue
Block a user