feat(maestro): debounce the gitroot probe in the spawn form
Typing in the raw cwd field fired one /api/gitroot request per keystroke (#74). Every keystroke now resets a 250ms window shared with the TUI draft (GITROOT_PROBE_DEBOUNCE_MS there); probeToken still owns ordering so a late answer can't overwrite a newer input.
This commit is contained in:
@@ -132,11 +132,13 @@ describe("spawnForm worktree defaults and branch picker (#61)", () => {
|
||||
it("still probes the gitroot for a free-text directory", async () => {
|
||||
const form = await mount();
|
||||
|
||||
// Escape hatch: switch to a free-text dir; only now does /api/gitroot fire.
|
||||
// Escape hatch: switch to a free-text dir; only now does /api/gitroot
|
||||
// fire — debounced, so the quiet period must elapse first (#74).
|
||||
form.querySelector<HTMLElement>(".project-row.project-other")!.click();
|
||||
const raw = form.querySelector<HTMLInputElement>("input[name=cwd_raw]")!;
|
||||
raw.value = "/opt/somewhere";
|
||||
raw.dispatchEvent(new Event("input"));
|
||||
await vi.advanceTimersByTimeAsync(250);
|
||||
await drain();
|
||||
|
||||
expect(urls.some((u) => u.includes("/api/gitroot"))).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user