Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(projects): save a description edit when you leave Overview right after typing (#11470)
pseudoyub1223401bcf4
diff --git a/packages/views/projects/components/project-detail.test.tsx b/packages/views/projects/components/project-detail.test.tsxindex dea1f0fe34..ecacb746cb 100644--- a/packages/views/projects/components/project-detail.test.tsx+++ b/packages/views/projects/components/project-detail.test.tsx@@ -160,7 +160,12 @@ vi.mock("../../editor", () => ({TitleEditor: ({ defaultValue }: { defaultValue: string }) => (<div>{defaultValue}</div>),- ContentEditor: () => null,+ ContentEditor: ({ flushPendingOnUnmount }: { flushPendingOnUnmount?: boolean }) => (+ <div+ data-testid="project-description"+ data-flush-on-unmount={flushPendingOnUnmount ? "true" : undefined}+ />+ ),ReadonlyContent: ({ content }: { content: string }) => <div>{content}</div>,}));@@ -346,6 +351,13 @@ describe("ProjectDetail tabs", () => {expect(within(screen.getByRole("complementary")).queryByText("Description")).not.toBeInTheDocument();});+ it("saves a pending description edit when the tab or page closes", () => {+ renderProjectDetail();+ // Switching tabs unmounts the editor, so a still-debounced edit has to+ // flush then; ContentEditor's own tests cover the flush itself.+ expect(screen.getByTestId("project-description")).toHaveAttribute("data-flush-on-unmount", "true");+ });+it("opens the panel with the properties, above the insights", () => {renderProjectDetail();const sidebar = screen.getByRole("complementary");diff --git a/packages/views/projects/components/project-overview.tsx b/packages/views/projects/components/project-overview.tsxindex 65186a484e..c3a23d78e2 100644--- a/packages/views/projects/components/project-overview.tsx+++ b/packages/views/projects/components/project-overview.tsx@@ -199,6 +199,9 @@ export function ProjectOverviewBody({placeholder={t(($) => $.detail.description_placeholder)}onUpdate={(md) => onUpdate({ description: md || null })}debounceMs={1500}+ // Switching tabs or leaving the page within the debounce must keep+ // what the user last typed.+ flushPendingOnUnmount/></ObjectSection>