updated the reference key for data and store to store mapping to @data: and @storeID: in composite.
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
<script>
|
||||
import { AppBar } from '@skeletonlabs/skeleton';
|
||||
export let store;
|
||||
</script>
|
||||
|
||||
<AppBar>
|
||||
<h1 class="h4">Nova</h1>
|
||||
<!-- <h1 class="h4">{$store.dapp.name}</h1> -->
|
||||
<!-- <svelte:fragment slot="trail">(actions)</svelte:fragment> -->
|
||||
</AppBar>
|
||||
|
@ -3,7 +3,6 @@
|
||||
export let store;
|
||||
|
||||
let isStoreLoaded = false;
|
||||
$: console.log('store: ' + JSON.stringify($store));
|
||||
|
||||
$: if (services && services.helloEarthAlert) {
|
||||
// services.helloEarthAlert.alertMe();
|
||||
|
@ -93,10 +93,13 @@
|
||||
if (component.map) {
|
||||
const localStore = getCompositeStore(component.id);
|
||||
|
||||
for (const [localKey, external] of Object.entries(component.map)) {
|
||||
const [externalID, externalKey] = external.split('.').map((item) => item.trim());
|
||||
for (const [localKey, mapping] of Object.entries(component.map)) {
|
||||
const isDataMapping = mapping.startsWith('@data:');
|
||||
const isStoreMapping = mapping.startsWith('@');
|
||||
|
||||
if (isDataMapping) {
|
||||
const externalKey = mapping.replace('@data:', '').trim();
|
||||
|
||||
if (externalID === 'data') {
|
||||
const unsubscribe = dataStore.subscribe((store) => {
|
||||
if (externalKey in store) {
|
||||
if (store[externalKey] && typeof store[externalKey].subscribe === 'function') {
|
||||
@ -114,7 +117,12 @@
|
||||
});
|
||||
|
||||
unsubscribers.push(unsubscribe);
|
||||
} else {
|
||||
} else if (isStoreMapping) {
|
||||
const [externalID, externalKey] = mapping
|
||||
.replace('@', '')
|
||||
.split(':')
|
||||
.map((item) => item.trim());
|
||||
|
||||
const externalStore = getCompositeStore(externalID);
|
||||
if (externalStore) {
|
||||
const unsubscribe = externalStore.subscribe((externalState) => {
|
||||
|
Reference in New Issue
Block a user