Skip to content

Commit 2852c5b

Browse files
grichaclaude
andcommitted
Add test for duplicate history loading bug
Verifies that the session.get API is not called when starting a new chat session - history should only load for existing sessions, not trigger again when session ID updates during active conversation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9338157 commit 2852c5b

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

web/e2e/chat.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,42 @@ test.describe('Chat', () => {
8282

8383
expect(react301Errors).toHaveLength(0);
8484
});
85+
86+
test('should not reload history when session ID updates during active chat', async ({ page }) => {
87+
let sessionGetCalls = 0;
88+
89+
await page.route('**/rpc/sessions.get**', async (route) => {
90+
sessionGetCalls++;
91+
await route.continue();
92+
});
93+
94+
await page.goto('/workspaces/test?tab=sessions');
95+
await page.waitForTimeout(1000);
96+
97+
const newChatButton = page.locator('button:has-text("New Chat")');
98+
if (!(await newChatButton.isVisible())) {
99+
test.skip();
100+
return;
101+
}
102+
103+
await newChatButton.click();
104+
await page.waitForTimeout(500);
105+
106+
const claudeOption = page.locator('text=Claude Code').first();
107+
if (await claudeOption.isVisible()) {
108+
await claudeOption.click();
109+
}
110+
111+
await page.waitForTimeout(1000);
112+
const initialCalls = sessionGetCalls;
113+
114+
const chatInput = page.locator('textarea[placeholder="Send a message..."]');
115+
if (await chatInput.isVisible()) {
116+
await chatInput.fill('test message');
117+
await page.keyboard.press('Enter');
118+
await page.waitForTimeout(3000);
119+
}
120+
121+
expect(sessionGetCalls).toBe(initialCalls);
122+
});
85123
});

0 commit comments

Comments
 (0)