summaryrefslogtreecommitdiffhomepage
path: root/src/app
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-28 00:20:52 +0900
committerAdam Malczewski <[email protected]>2026-06-28 08:50:13 +0900
commit7300c233ab2ce3e3d20fef9b6b051e36a509bcdc (patch)
tree88aafd2e49c0a7637b0a53fceb1a6f705d3ef1bb /src/app
parenta59200e786f7d97d7ba5b9cd2bee9ffef531dac2 (diff)
downloaddispatch-web-7300c233ab2ce3e3d20fef9b6b051e36a509bcdc.tar.gz
dispatch-web-7300c233ab2ce3e3d20fef9b6b051e36a509bcdc.zip
fix(cache-display): fix stale cache info on unloaded steps + missing cache percentages on active steps
Diffstat (limited to 'src/app')
-rw-r--r--src/app/store.test.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/app/store.test.ts b/src/app/store.test.ts
index 2cf473c..e1a11e0 100644
--- a/src/app/store.test.ts
+++ b/src/app/store.test.ts
@@ -553,13 +553,17 @@ describe("createAppStore", () => {
event: { type: "turn-sealed", conversationId: convId, turnId: "turn-1" },
});
- await new Promise((r) => setTimeout(r, 50));
-
- expect(fetchedUrls.some((u) => u.includes(`/conversations/${convId}?sinceSeq=`))).toBe(true);
-
- await new Promise((r) => setTimeout(r, 50));
+ // `turn-sealed` triggers an async `syncTail` (cache.sinceSeq → historySync
+ // → cache.commit → applyHistory). Poll for the side-effect rather than
+ // guessing a fixed delay — under suite load a fixed `setTimeout` raced the
+ // fetch chain and flaked here.
+ await vi.waitFor(() => {
+ expect(fetchedUrls.some((u) => u.includes(`/conversations/${convId}?sinceSeq=`))).toBe(true);
+ });
- expect(store.activeChat.chunks.length).toBeGreaterThan(0);
+ await vi.waitFor(() => {
+ expect(store.activeChat.chunks.length).toBeGreaterThan(0);
+ });
store.dispose();
});