diff --git a/src/lib/components/HelloEarth/HelloEarth.svelte b/src/lib/components/HelloEarth/HelloEarth.svelte index 405a21a..86c66a5 100644 --- a/src/lib/components/HelloEarth/HelloEarth.svelte +++ b/src/lib/components/HelloEarth/HelloEarth.svelte @@ -1,20 +1,12 @@ diff --git a/src/lib/core/Composite.svelte b/src/lib/core/Composite.svelte index 592e996..872aef1 100644 --- a/src/lib/core/Composite.svelte +++ b/src/lib/core/Composite.svelte @@ -27,6 +27,17 @@ export let composite: IComposite; + let loadedServices: Record = {}; + + // Reactive loading mechanism for services based on composite changes + $: if (composite?.services) { + composite.services.forEach(async (serviceName) => { + if (!loadedServices[serviceName]) { + loadedServices[serviceName] = await loadService(serviceName); + } + }); + } + $: layoutStyle = composite?.layout ? ` grid-template-areas: ${composite.layout.areas}; @@ -141,13 +152,13 @@ {#if composite && 'component' in composite} - {#await loadComponentAndService(composite) then [Component, serviceProps]} + {#await loadComponentAndService(composite) then [Component]} {#if Component} {:else if composite.component} Component {composite.component} not found. @@ -158,13 +169,13 @@ {#if composite?.children} {#each composite.children as child (child.id)} - {#await loadComponentAndService(child) then [ChildComponent, childServiceProps]} + {#await loadComponentAndService(child) then [ChildComponent]} {#if ChildComponent} {#if child.children && child.children.length}
Component {composite.component} not found.