From 41b1b89fcb680ec4976215c3430eab14eb4a63da Mon Sep 17 00:00:00 2001 From: James Brunton Date: Tue, 14 Jul 2026 10:43:07 +0100 Subject: [PATCH] Fix Policies page showing the Editor as a source twice (#7022) # Description of Changes The Policies page currently hard-codes the Editor to be available as a source, but we now also have a virtual Editor source on the backend, which the Policies page also renders. This removes the now-unnecessary hard-coded Editor source. ## Before image ## After image --- .../components/policies/PolicySetupWizard.tsx | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx b/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx index 9dada09290..9dce344b89 100644 --- a/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx +++ b/frontend/editor/src/portal/components/policies/PolicySetupWizard.tsx @@ -213,22 +213,11 @@ function PolicySetupWizardBody({ ); const sourcesAsync = useAsync(() => fetchSources(), []); - const availableSources = useMemo(() => { - const backendSources = (sourcesAsync.data?.sources ?? []).filter( - (s) => s.status !== "disabled", - ); - const editorSource = { - id: "editor", - name: t("portal.sources.types.editor.label"), - type: "editor", - status: "active" as const, - referenceCount: 0, - referencingPolicies: [], - config: [], - docsTotal: null, - }; - return [editorSource, ...backendSources]; - }, [sourcesAsync.data, t]); + const availableSources = useMemo( + () => + (sourcesAsync.data?.sources ?? []).filter((s) => s.status !== "disabled"), + [sourcesAsync.data], + ); // Document-type scoping has no UI; preserve any saved scope on edit and // default new policies to all document types. const [scopeTypes] = useState(policy?.state.scopeTypes ?? []); @@ -475,9 +464,8 @@ function PolicySetupWizardBody({ {t("portal.policies.wizard.sources.loading")}

) : ( - // The editor is always an available source (unconditionally prepended - // to availableSources), so the list is never empty — no "no sources" - // state exists. + // The backend always returns the editor as a virtual source, so the + // loaded list is never empty - no "no sources" state exists.
{availableSources.map((src) => ( // A selectable multi-line tile (icon + name + type + check).