Updated the Messages to the new abstracted composite syntax.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { onDestroy } from 'svelte';
|
||||
import Composite from './Composite.svelte';
|
||||
import components from '$lib/core/componentLoader';
|
||||
import services from '$lib/core/servicesLoader';
|
||||
@ -66,9 +66,19 @@
|
||||
if (externalID === 'data') {
|
||||
const unsubscribe = dataStore.subscribe((store) => {
|
||||
if (externalKey in store) {
|
||||
localStore.update((storeValue) => {
|
||||
return { ...storeValue, [localKey]: store[externalKey] };
|
||||
});
|
||||
// Check if the data item is a Svelte store
|
||||
if (store[externalKey] && typeof store[externalKey].subscribe === 'function') {
|
||||
let innerUnsub = store[externalKey].subscribe((value) => {
|
||||
localStore.update((storeValue) => {
|
||||
return { ...storeValue, [localKey]: value };
|
||||
});
|
||||
});
|
||||
onDestroy(innerUnsub);
|
||||
} else {
|
||||
localStore.update((storeValue) => {
|
||||
return { ...storeValue, [localKey]: store[externalKey] };
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user