From 194dc8a5a9b515ba51c44d4064977a4826caec7e Mon Sep 17 00:00:00 2001 From: Guilhem Date: Mon, 23 Jun 2025 11:58:24 +0100 Subject: [PATCH] reset module initial if test flow initial is reset --- .../src/lib/components/FlowPreviewContent.svelte | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/FlowPreviewContent.svelte b/frontend/src/lib/components/FlowPreviewContent.svelte index 705eb84fc6..dc73b04671 100644 --- a/frontend/src/lib/components/FlowPreviewContent.svelte +++ b/frontend/src/lib/components/FlowPreviewContent.svelte @@ -70,10 +70,9 @@ } = getContext('FlowEditorContext') const dispatch = createEventDispatcher() - // Set all modules as initial when flow-level initial becomes true function setAllModulesInitial(isInitial: boolean) { + // Set all existing modules in flowStateStore to initial value if (isInitial) { - // Set all existing modules in flowStateStore to initial: true for (const moduleId in $flowStateStore) { if ($flowStateStore[moduleId] && $flowStateStore[moduleId].initial === undefined) { $flowStateStore[moduleId] = { @@ -82,8 +81,17 @@ } } } - $flowStateStore = $flowStateStore + } else { + for (const moduleId in $flowStateStore) { + if ($flowStateStore[moduleId] && $flowStateStore[moduleId].initial) { + $flowStateStore[moduleId] = { + ...$flowStateStore[moduleId], + initial: false + } + } + } } + $flowStateStore = $flowStateStore } let renderCount: number = 0