remapping gql from placeholder to $me.store

This commit is contained in:
Samuel Andert 2023-08-07 15:29:02 +02:00
parent 783548581c
commit cbf059acca
4 changed files with 14 additions and 19 deletions

View File

@ -14,8 +14,8 @@
{/if}
<br />
dataTest:
{#if $me.x}
{JSON.stringify($me.x)}
{#if $me.store}
{JSON.stringify($me.store.test)}
{/if}
</section>
</div>

View File

@ -60,13 +60,15 @@
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) => {
return {
...storeValue,
store: {
...storeValue.store,
...component.data.gql
}
};
});
}
}
getComposerStore(component.id).update((storeValue) => ({

View File

@ -2,5 +2,6 @@ query queryTest {
repoGet(owner: "samuelandert.eth", repo: "learn") {
id
name
link
}
}

View File

@ -1,8 +1,7 @@
<script lang="ts">
import type { PageData } from '../test/$houdini';
import Composer from '$lib/core/refactor/Composer.svelte';
import { queryTodos } from '$lib/data/queryTodos';
import { onMount } from 'svelte';
import type { PageData } from '../test/$houdini';
export let data: PageData;
@ -29,11 +28,8 @@
id: 'ComposerGraph',
component: 'ComposerGraph',
data: {
map: {
todos: queryTodos
},
gql: {
test: await $queryTest.data
test: $queryTest.data
}
},
machine: {
@ -61,8 +57,4 @@
});
</script>
{#if $queryTest}
{JSON.stringify($queryTest.data, null, 2)}
{/if}
<Composer {composer} />