diff --git a/frontend/src/lib/components/FlowPreviewContent.svelte b/frontend/src/lib/components/FlowPreviewContent.svelte index f702b84397..1b8b126ca4 100644 --- a/frontend/src/lib/components/FlowPreviewContent.svelte +++ b/frontend/src/lib/components/FlowPreviewContent.svelte @@ -652,6 +652,13 @@ onDone={async ({ job: completedJob }) => { isRunning = false $executionCount = $executionCount + 1 + // Reset 'initial' flags for modules that were part of this flow test, + // so OutputPicker no longer shows "Run loaded from history" + for (const mod of completedJob.flow_status?.modules ?? []) { + if (mod.id) { + stepHistoryLoader?.resetInitial(mod.id) + } + } if (flowRecording.active) { lastRecording = flowRecording.stop() setActiveRecording(undefined) diff --git a/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte b/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte index c1662a8f80..6bc4686644 100644 --- a/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte +++ b/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte @@ -204,7 +204,8 @@ } function updateLastJob() { - if (testJob) { + // Prefer testJob only when actively running/streaming (individual step test in progress) + if (testJob && (testJob.result_stream || testJob.type === 'QueuedJob')) { return testJob } if ( @@ -214,6 +215,8 @@ ) { return } + // Use flowStateStore as source of truth — it's updated by both individual step tests + // (ModuleTest.jobDone) and flow tests (FlowStatusViewerInner.onJobsLoadedInner) return { id: flowStateStore.val[moduleId]?.previewJobId ?? '', result: flowStateStore.val[moduleId]?.previewResult,