⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(custom-fields): retain hidden selections during menu refresh
Tin54c18a3d02e5
diff --git a/apps/web/src/components/task/custom-field-multi-select.test.tsx b/apps/web/src/components/task/custom-field-multi-select.test.tsxindex 0f1372ff9..92cd4738b 100644--- a/apps/web/src/components/task/custom-field-multi-select.test.tsx+++ b/apps/web/src/components/task/custom-field-multi-select.test.tsx@@ -96,3 +96,35 @@ it("keeps hidden selections readable and removable outside the menu", async () =);expect(commit).toHaveBeenLastCalledWith([]);});++it("retains a selection hidden remotely while its menu is open", async () => {+ const commit = vi.fn();+ const allOptions = [...options, "Third person"];+ function Fixture({ hidden }: { hidden: string[] }) {+ const [value, setValue] = useState([options[0]]);+ return (+ <CustomFieldMultiSelect+ name="Attendees"+ options={allOptions}+ hiddenOptions={hidden}+ value={value}+ onChange={setValue}+ onCommit={commit}+ />+ );+ }+ const view = render(<Fixture hidden={[]} />);+ fireEvent.click(screen.getByRole("combobox", { name: "Attendees" }));+ await screen.findByRole("option", { name: options[0] });+ view.rerender(<Fixture hidden={[options[0]]} />);+ await waitFor(() =>+ expect(+ screen.queryByRole("option", { name: options[0] }),+ ).not.toBeInTheDocument(),+ );+ fireEvent.keyDown(screen.getByRole("option", { name: options[1] }), {+ key: "Escape",+ });+ await waitFor(() => expect(commit).toHaveBeenLastCalledWith([options[0]]));+ expect(screen.getByRole("listitem")).toHaveTextContent(options[0]);+});diff --git a/apps/web/src/components/task/custom-field-multi-select.tsx b/apps/web/src/components/task/custom-field-multi-select.tsxindex 4125abe86..113d1b29f 100644--- a/apps/web/src/components/task/custom-field-multi-select.tsx+++ b/apps/web/src/components/task/custom-field-multi-select.tsx@@ -41,7 +41,7 @@ export default function CustomFieldMultiSelect({<div className="space-y-2"><Selectmultiple- items={visibleOptions.map((option) => ({+ items={options.map((option) => ({value: option,label: option,}))}@@ -80,11 +80,17 @@ export default function CustomFieldMultiSelect({alignItemWithTrigger={false}className="w-(--anchor-width)">- {visibleOptions.map((option) => (+ {options.map((option) => (<SelectItemkey={option}value={option}- className="grid-cols-[1rem_minmax(0,1fr)] items-start py-1.5 leading-5"+ hidden={hiddenOptions.includes(option)}+ disabled={hiddenOptions.includes(option)}+ className={+ hiddenOptions.includes(option)+ ? "hidden"+ : "grid-cols-[1rem_minmax(0,1fr)] items-start py-1.5 leading-5"+ }><span className="block whitespace-normal break-words text-left">{option}