Skip to content

Commit 1a421bb

Browse files
committed
test(webapp): pin the query string where it can actually change
The unmount case repeated its neighbour and no query string can reach unmountTeardown. Guard the pathname tracking that does decide it.
1 parent 732b2e8 commit 1a421bb

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

apps/webapp/app/components/dashboard-agent/turn-teardown.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ describe("unmountTeardown", () => {
3232
"navigated-away"
3333
);
3434
});
35-
36-
it("ignores the query string, so filtering a page is not leaving it", () => {
37-
// Both sides are pathnames; a filter change never reaches this comparison.
38-
expect(unmountTeardown({ renderedPath: path, livePath: path })).toBe("panel-closed");
39-
});
4035
});
4136

4237
/**
@@ -56,6 +51,15 @@ describe("the chat cancels its turn only on the teardowns that say so", () => {
5651
expect(chat).toContain("livePath: window.location.pathname");
5752
});
5853

54+
// Where "filtering a page is not leaving it" actually lives: both sides are pathnames, so a
55+
// query string never reaches the comparison. Widen either side and a filter change reads as a
56+
// navigation, cancelling the turn.
57+
it("tracks the rendered path without its query string", () => {
58+
expect(chat).toContain("useRef(location.pathname)");
59+
expect(chat).toContain("renderedPathRef.current = location.pathname;");
60+
expect(chat).not.toContain("location.search");
61+
});
62+
5963
it("runs the cleanup once, not on every path change", () => {
6064
const teardown = chat.slice(chat.indexOf("const teardownRef"));
6165
expect(teardown).toMatch(

0 commit comments

Comments
 (0)