fix(ui): project detail close replaces history to match the other detail pages

Adopts the close semantics from PR #36013 so browser Back after an
in-page close leaves the Projects page instead of reopening the
dismissed detail; the close test now pins the replace mode
This commit is contained in:
ryan-crabbe-berri 2026-08-05 15:26:54 -07:00
parent dc178acf5b
commit dbf9392f24
2 changed files with 7 additions and 1 deletions

View file

@ -243,6 +243,7 @@ describe("ProjectsPage", () => {
await waitFor(() => {
expect(onUrlUpdate).toHaveBeenLastCalledWith(expect.objectContaining({ queryString: "" }));
});
expect(onUrlUpdate.mock.calls.at(-1)?.[0].options.history).toBe("replace");
expect(screen.queryByTestId("project-detail")).not.toBeInTheDocument();
expect(screen.getByText("Alpha Project")).toBeInTheDocument();
});

View file

@ -48,7 +48,12 @@ export function ProjectsPage() {
}, [projects, searchText, teamAliasMap]);
if (selectedProjectId) {
return <ProjectDetail projectId={selectedProjectId} onBack={() => void setSelectedProjectId(null)} />;
return (
<ProjectDetail
projectId={selectedProjectId}
onBack={() => void setSelectedProjectId(null, { history: "replace" })}
/>
);
}
return (