From c2eb502fb9f337fed94ca293da540ff8b6b521b0 Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Sat, 29 Aug 2026 10:40:31 +0200 Subject: [PATCH] fix(integrations): default build-handoff picker to existing project on exact match MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit George's own OrangeCat profile card kept opening FleetCrown and proposing a brand-new project even when a FleetCrown project with the same name already existed ("there is already fleetcrown project on fleetcrown"). The picker on this page already listed existing projects and let you switch to "Link an existing project" — it just defaulted to "new" unconditionally, so the duplicate was the path of least resistance. Default to "existing" (with that project pre-selected) whenever an existing project's name matches the OrangeCat entity's title exactly, and show a "— already exists" hint next to the option so the reasoning is visible. "Create a new project" is still one click away for genuinely new work. --- .../integrations/OrangeCatBuildHandoff.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/integrations/OrangeCatBuildHandoff.tsx b/src/components/integrations/OrangeCatBuildHandoff.tsx index 8058810b..23eb1b49 100644 --- a/src/components/integrations/OrangeCatBuildHandoff.tsx +++ b/src/components/integrations/OrangeCatBuildHandoff.tsx @@ -18,8 +18,17 @@ export function OrangeCatBuildHandoff({ intent: OrangeCatBuildIntent; projects: ProjectOption[]; }) { - const [mode, setMode] = useState<"new" | "existing">("new"); - const [projectId, setProjectId] = useState(projects[0]?.id ?? ""); + // If a project with the exact same name already exists, default to linking + // it instead of "new" — the whole point of offering a picker is defeated if + // the obvious match still requires the user to notice and switch the radio + // themselves. "Bitbaum" on OrangeCat and "Bitbaum" on FleetCrown are almost + // certainly the same thing; proposing a second "Bitbaum" project by default + // is exactly the duplicate this picker exists to prevent. + const exactMatch = projects.find( + (project) => project.name.trim().toLowerCase() === intent.entity.title.trim().toLowerCase() + ); + const [mode, setMode] = useState<"new" | "existing">(exactMatch ? "existing" : "new"); + const [projectId, setProjectId] = useState(exactMatch?.id ?? projects[0]?.id ?? ""); const [submitting, setSubmitting] = useState(false); const [error, setError] = useState(""); @@ -107,7 +116,14 @@ export function OrangeCatBuildHandoff({ className="mt-1" /> - Link an existing project + + Link an existing project + {exactMatch && ( + + — “{exactMatch.name}” already exists + + )} +