From 6dfd894bb0430c7512abc778c6c393bb600b8704 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Fri, 28 Aug 2026 10:43:54 +0100 Subject: [PATCH] Fix race --- .../editor/src/portal/views/PipelineBuilder.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/editor/src/portal/views/PipelineBuilder.tsx b/frontend/editor/src/portal/views/PipelineBuilder.tsx index 3743384073..4e46190693 100644 --- a/frontend/editor/src/portal/views/PipelineBuilder.tsx +++ b/frontend/editor/src/portal/views/PipelineBuilder.tsx @@ -340,6 +340,12 @@ export function PipelineBuilder() { if (seeded) return; if (isEdit && !policyState.data) return; const policy = policyState.data ?? undefined; + // An editor pipeline is recognised by the editor source id, which arrives with the sources + // fetch. If the policy loads first, seeding now would latch a blank input and re-save the + // pipeline off the editor (editor.allowed:false), so wait for that fetch to settle. + if (policy?.editor?.allowed && !sourcesState.data && !sourcesState.error) { + return; + } setName(policy?.name ?? ""); setEnabled(policy?.enabled ?? true); // The one input row is always present: blank for a new pipeline (or a legacy policy saved @@ -370,7 +376,14 @@ export function PipelineBuilder() { ); setOutputIds(seedsEditor ? [] : (policy?.outputIds ?? [])); setSeeded(true); - }, [isEdit, policyState.data, allTools, seeded, sourcesState.data]); + }, [ + isEdit, + policyState.data, + allTools, + seeded, + sourcesState.data, + sourcesState.error, + ]); const sourceType = (sourceId: string) => availableSources.find((s) => s.id === sourceId)?.type;