diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte index c2905f3b5d..17b188a553 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte @@ -144,15 +144,24 @@ runnable && runnable.type === 'runnableByName' ? runnable.inlineScript?.refreshOn ?? [] : [] function refreshIfAutoRefresh(src: 'arg changed' | 'static changed') { + // console.log( + // 'refreshIfAutoRefresh', + // src, + // id, + // iterContext ? $iterContext : undefined, + // $rowContext ? $rowContext : undefined, + // firstRefresh + // ) if (firstRefresh) { firstRefresh = false if ( src == 'arg changed' && args == undefined && + result != undefined && Object.keys(runnableInputValues ?? {}).length == 0 && Object.keys(extraQueryParams ?? {}).length == 0 ) { - // console.debug(`Skipping refreshing ${id} because ${_src} (first)`) + console.log('skipping refresh because first refresh') return } } diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableWrapper.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableWrapper.svelte index 968366ca6d..ffad8c3960 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableWrapper.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableWrapper.svelte @@ -2,7 +2,7 @@ import { getContext, onMount } from 'svelte' import type { AppInput } from '../../inputType' import type { Output } from '../../rx' - import type { AppViewerContext } from '../../types' + import type { AppViewerContext, ListContext } from '../../types' import { isScriptByNameDefined, isScriptByPathDefined } from '../../utils' import NonRunnableComponent from './NonRunnableComponent.svelte' import RunnableComponent from './RunnableComponent.svelte' @@ -98,6 +98,8 @@ const { staticExporter, initialized, noBackend, componentControl, runnableComponents } = getContext('AppViewerContext') + const iterContext = getContext('ListWrapperContext') + const rowContext = getContext('RowWrapperContext') if (noBackend && componentInput?.type == 'runnable') { result = componentInput?.['value'] @@ -113,18 +115,24 @@ } }) + const fullId = id + (extraKey ?? '') if (!(initializing && componentInput?.type === 'runnable' && isRunnableDefined(componentInput))) { initializing = false } else { if ( (initializing == undefined || initializing == true) && - Object.keys($initialized?.runnableInitialized ?? {}).includes(id) + Object.keys($initialized?.runnableInitialized ?? {}).includes(fullId) ) { initializing = false } - if (result == undefined && !initializing) { - result = $initialized.runnableInitialized?.[id] + if ( + result == undefined && + !initializing && + iterContext == undefined && + rowContext == undefined + ) { + result = $initialized.runnableInitialized?.[fullId] } } @@ -294,11 +302,11 @@ on:argsChanged on:resultSet={(e) => { const res = e.detail - if ($initialized?.runnableInitialized?.[id] === undefined) { + if ($initialized?.runnableInitialized?.[fullId] === undefined) { console.log('resultSet', id) $initialized.runnableInitialized = { ...($initialized.runnableInitialized ?? {}), - [id]: res + [fullId]: res } }