From 6f9c2da0ac651146afcf3ce845452528b709e346 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Fri, 4 Aug 2023 18:53:14 +0200 Subject: [PATCH] cleanup of composer --- .../components/refactor/ComposerWrap.svelte | 1 - src/lib/core/refactor/Composer.svelte | 49 +++++-------------- src/lib/core/refactor/ComposerComponent.svelt | 0 .../core/refactor/ComposerComponent.svelte | 38 -------------- src/lib/core/refactor/queryLoader.ts | 13 ++++- 5 files changed, 25 insertions(+), 76 deletions(-) delete mode 100644 src/lib/core/refactor/ComposerComponent.svelt delete mode 100644 src/lib/core/refactor/ComposerComponent.svelte diff --git a/src/lib/components/refactor/ComposerWrap.svelte b/src/lib/components/refactor/ComposerWrap.svelte index 0189c82..4ff195e 100644 --- a/src/lib/components/refactor/ComposerWrap.svelte +++ b/src/lib/components/refactor/ComposerWrap.svelte @@ -1,7 +1,6 @@ - - diff --git a/src/lib/core/refactor/queryLoader.ts b/src/lib/core/refactor/queryLoader.ts index bc542f3..48336c5 100644 --- a/src/lib/core/refactor/queryLoader.ts +++ b/src/lib/core/refactor/queryLoader.ts @@ -1,6 +1,7 @@ // dataLoader.ts import { writable } from 'svelte/store'; import dataSources from 'virtual:data-sources-list'; +import { coreServices } from './coreServices'; // The store that holds the data sets export const queryStore = writable({}); @@ -13,4 +14,14 @@ dataSources.forEach(src => { queryStore.update(store => ({ ...store, [src]: moduleData })); }); -}); \ No newline at end of file +}); + +export function subscribeAndMapQueries(id: string, queryMap: Record) { + Object.entries(queryMap).forEach(([name, query]) => { + query.subscribe((value) => { + if (value) { + coreServices.mutateStore(id, { [name]: value }); + } + }); + }); +} \ No newline at end of file