fix(run): scope resume session picker to the typed cwd when no lane is selected
Without a lane, the picker had no cwd filter and listed every session across every repo. Fall back to the free-typed cwd field so resume suggestions stay scoped to the working directory in view.
This commit is contained in:
@@ -163,7 +163,9 @@ export function RunSetup(props: RunSetupProps) {
|
|||||||
// props.resumeSession here would resume nothing.
|
// props.resumeSession here would resume nothing.
|
||||||
if (s && !props.busy) handleStart(props, s);
|
if (s && !props.busy) handleStart(props, s);
|
||||||
}}
|
}}
|
||||||
cwd={props.laneCwd}
|
// Fall back to the typed cwd when no lane is selected — otherwise
|
||||||
|
// an unfiltered picker lists every session from every repo.
|
||||||
|
cwd={props.laneCwd || props.cwd.trim() || undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -227,9 +227,21 @@ describe("RunSetup — resume picker scopes sessions to the selected lane", () =
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lists everything when no lane is selected", async () => {
|
it("falls back to the typed cwd when no lane is selected", async () => {
|
||||||
const { api } = await import("../../../lib/api");
|
const { api } = await import("../../../lib/api");
|
||||||
renderSetup({ laneCwd: undefined });
|
renderSetup({ laneCwd: undefined, cwd: "/Users/tester" });
|
||||||
|
fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption")));
|
||||||
|
fireEvent.click(screen.getByText(i18n.t("run:resume.pickSession")));
|
||||||
|
|
||||||
|
await new Promise((r) => setTimeout(r, 0));
|
||||||
|
expect(api.sessions.list).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ cwd: "/Users/tester" })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("lists everything when no lane is selected and cwd is empty", async () => {
|
||||||
|
const { api } = await import("../../../lib/api");
|
||||||
|
renderSetup({ laneCwd: undefined, cwd: "" });
|
||||||
fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption")));
|
fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption")));
|
||||||
fireEvent.click(screen.getByText(i18n.t("run:resume.pickSession")));
|
fireEvent.click(screen.getByText(i18n.t("run:resume.pickSession")));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user