updated the reference key for data and store to store mapping to @data: and @storeID: in composite.
This commit is contained in:
@ -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