From da12a659255b91cf1c57c8b211572be005db0955 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 23 Aug 2023 12:18:02 +0200 Subject: [PATCH] fix: fix tables not updating inputs on creation --- .../apps/components/buttons/AppButton.svelte | 20 +++++++++++++++++-- .../components/display/AppCarouselList.svelte | 4 ++-- .../components/display/table/AppTable.svelte | 7 ++++--- .../apps/components/layout/AppList.svelte | 4 ++-- .../apps/components/layout/ListWrapper.svelte | 6 +++--- .../apps/components/layout/RowWrapper.svelte | 6 +++--- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte index 8a2b1b2e27..819da2643f 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte @@ -40,6 +40,8 @@ getContext('AppViewerContext') const rowContext = getContext('RowWrapperContext') const rowInputs: ListInputs | undefined = getContext('RowInputs') + const iterContext = getContext('ListWrapperContext') + const listInputs: ListInputs | undefined = getContext('ListInputs') let resolvedConfig = initConfig( components['buttoncomponent'].initialData.configuration, @@ -54,6 +56,17 @@ jobId: undefined }) + if (rowContext && rowInputs) { + const inputOutput = { result: outputs.result.peak(), loading: false } + rowInputs(id, inputOutput) + } + + if (iterContext && listInputs) { + const inputOutput = { result: outputs.result.peak(), loading: false } + listInputs(id, inputOutput) + } + + console.log('FOO') if (controls) { $componentControl[id] = controls } @@ -89,9 +102,12 @@ event?.preventDefault() $selectedComponent = [id] - + const inputOutput = { result: outputs.result.peak(), loading: true } if (rowContext && rowInputs) { - rowInputs(id, { result: outputs.result.peak(), loading: true }) + rowInputs(id, inputOutput) + } + if (iterContext && listInputs) { + listInputs(id, inputOutput) } if (preclickAction) { await preclickAction() diff --git a/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte b/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte index 6ce4a5658b..3339373282 100644 --- a/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte +++ b/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte @@ -137,7 +137,7 @@ {#each result ?? [] as value, index}
{ + onInputsChange={() => { outputs?.inputs.set(inputs, true) }} bind:inputs @@ -164,7 +164,7 @@ {/key} {:else} - + {}} disabled value={undefined} index={0}> {#if !Array.isArray(result)} diff --git a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte index 83944985e1..d0bbe483ff 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte @@ -362,12 +362,13 @@
{#each actionButtons as actionButton, actionIndex (actionButton?.id)} { - outputs?.inputs.set(inputs, true) - }} bind:inputs value={row.original} index={rowIndex} + + onInputsChange={() => { + outputs?.inputs.set(inputs, true) + }} >
{ + onInputsChange={() => { outputs?.inputs.set(inputs, true) }} bind:inputs @@ -164,7 +164,7 @@
{/each} {:else} - + {}} disabled value={undefined} index={0}> {#if !Array.isArray(result)} diff --git a/frontend/src/lib/components/apps/components/layout/ListWrapper.svelte b/frontend/src/lib/components/apps/components/layout/ListWrapper.svelte index 182699c6a9..1446ea0234 100644 --- a/frontend/src/lib/components/apps/components/layout/ListWrapper.svelte +++ b/frontend/src/lib/components/apps/components/layout/ListWrapper.svelte @@ -1,5 +1,5 @@ diff --git a/frontend/src/lib/components/apps/components/layout/RowWrapper.svelte b/frontend/src/lib/components/apps/components/layout/RowWrapper.svelte index 65a6078f80..3fed950975 100644 --- a/frontend/src/lib/components/apps/components/layout/RowWrapper.svelte +++ b/frontend/src/lib/components/apps/components/layout/RowWrapper.svelte @@ -1,5 +1,5 @@