From 783548581c5b4a79903e9c99625f1fc4fd7041cb Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Mon, 7 Aug 2023 15:01:30 +0200 Subject: [PATCH] added basic graphql mapping --- .../components/refactor/ComposerGraph.svelte | 5 ++ src/lib/core/refactor/Composer.svelte | 9 ++ src/routes/graphql/+page.svelte | 88 +++++++++++-------- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/src/lib/components/refactor/ComposerGraph.svelte b/src/lib/components/refactor/ComposerGraph.svelte index ce00d1d..e517d7b 100644 --- a/src/lib/components/refactor/ComposerGraph.svelte +++ b/src/lib/components/refactor/ComposerGraph.svelte @@ -12,5 +12,10 @@

{todo.text}

{/each} {/if} +
+ dataTest: + {#if $me.x} + {JSON.stringify($me.x)} + {/if} diff --git a/src/lib/core/refactor/Composer.svelte b/src/lib/core/refactor/Composer.svelte index 9c8330e..baba950 100644 --- a/src/lib/core/refactor/Composer.svelte +++ b/src/lib/core/refactor/Composer.svelte @@ -59,6 +59,15 @@ if (component.data?.map) { subscribeAndMapQueries(component.id, component.data.map); } + if (component.data?.gql) { + getComposerStore(component.id).update((storeValue) => ({ + ...storeValue, + x: { + ...storeValue.x, + ...component.data.gql + } + })); + } } getComposerStore(component.id).update((storeValue) => ({ ...storeValue, diff --git a/src/routes/graphql/+page.svelte b/src/routes/graphql/+page.svelte index 3fa1ba7..bc5416c 100644 --- a/src/routes/graphql/+page.svelte +++ b/src/routes/graphql/+page.svelte @@ -1,58 +1,68 @@ -{JSON.stringify($queryTest.data, null, 2)} +{#if $queryTest} + {JSON.stringify($queryTest.data, null, 2)} +{/if}