From 483e5f49e0f449134032a4adc6466eef2c477b21 Mon Sep 17 00:00:00 2001 From: Shaheer Sarfaraz <53654735+DaKheera47@users.noreply.github.com> Date: Fri, 20 Feb 2026 18:22:05 +0000 Subject: [PATCH] fix(orchestrator): keep search term chips when backspacing empty input (#215) --- .../orchestrator/AutomaticRunTab.test.tsx | 31 ++++++++++++++++++- .../pages/orchestrator/AutomaticRunTab.tsx | 9 ------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx index bd28f73..c227a3a 100644 --- a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx +++ b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.test.tsx @@ -1,5 +1,5 @@ import { createAppSettings } from "@shared/testing/factories.js"; -import { render, screen, waitFor } from "@testing-library/react"; +import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import type React from "react"; import { describe, expect, it, vi } from "vitest"; import { AutomaticRunTab } from "./AutomaticRunTab"; @@ -155,4 +155,33 @@ describe("AutomaticRunTab", () => { "Set a Glassdoor city in Advanced settings to enable Glassdoor.", ); }); + + it("does not remove existing search terms when Backspace is pressed on an empty input", () => { + render( + , + ); + + const input = screen.getByPlaceholderText("Type and press Enter"); + fireEvent.keyDown(input, { key: "Backspace" }); + + expect( + screen.getByRole("button", { name: "Remove backend engineer" }), + ).toBeInTheDocument(); + expect( + screen.getByRole("button", { name: "Remove frontend engineer" }), + ).toBeInTheDocument(); + }); }); diff --git a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx index 720e66a..7efd2d7 100644 --- a/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx +++ b/orchestrator/src/client/pages/orchestrator/AutomaticRunTab.tsx @@ -479,15 +479,6 @@ export const AutomaticRunTab: React.FC = ({ setValue("searchTermDraft", ""); return; } - if ( - event.key === "Backspace" && - searchTermDraft.length === 0 && - searchTerms.length > 0 - ) { - setValue("searchTerms", searchTerms.slice(0, -1), { - shouldDirty: true, - }); - } }} onBlur={() => { addSearchTerms(searchTermDraft);