abstracting generic queryStoreMapping
This commit is contained in:
@ -90,6 +90,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
function subscribeAndMapQueries(id: string, queryMap: Record<string, any>) {
|
||||
Object.entries(queryMap).forEach(([name, query]) => {
|
||||
query.subscribe((value) => {
|
||||
if (value) {
|
||||
coreServices.mutateStore(id, { [name]: value });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function computeLayoutStyle(layout?: IComposerLayout): string {
|
||||
if (!layout) return '';
|
||||
return `
|
||||
@ -101,10 +111,13 @@
|
||||
}
|
||||
|
||||
function initializeComposerState(child: IComposer) {
|
||||
if (!child) return; // Add this line
|
||||
if (!child) return;
|
||||
|
||||
if (child.id) {
|
||||
child.store = createComposerStore(child.id, child.store || {});
|
||||
if (child.data?.queries) {
|
||||
subscribeAndMapQueries(child.id, child.data.queries);
|
||||
}
|
||||
}
|
||||
|
||||
if (child.children) {
|
||||
|
Reference in New Issue
Block a user