From af091d0ee5332c834f14b60b5d09b37dcbc9a4bb Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Wed, 14 Oct 2026 00:43:25 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20tests:=20Storybook=20draft=20moc?= =?UTF-8?q?ks=20share=20one=20revision=20sequence=20per=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #6389 --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --- src/browser/stories/mocks/drafts.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/browser/stories/mocks/drafts.ts b/src/browser/stories/mocks/drafts.ts index fca89ec5c63..e14098ebde9 100644 --- a/src/browser/stories/mocks/drafts.ts +++ b/src/browser/stories/mocks/drafts.ts @@ -17,6 +17,16 @@ interface StoredDraft { revision: number; } +/** + * One revision sequence for the whole page, as a real backend never answers below its earlier + * revisions (DraftService seeds them from its start time; stories freeze Date.now, so that does + * not work here). The DraftStore is one per page and outlives each story's mock client: with a + * sequence per client, a story that reused a workspace ID got write replies older than the + * previous story's last view, and the store applied that old (empty) view over the text being + * typed (#6389). + */ +let revision = 1; + /** * In-memory drafts API for Storybook. Stories seed drafts through the legacy localStorage keys * (stories/helpers/drafts.ts, uiState.ts), which the DraftStore imports on hydration exactly like @@ -25,7 +35,6 @@ interface StoredDraft { export function createMockDraftsApi() { const drafts = new Map(); const listeners = new Set<(event: DraftEvent) => void>(); - let revision = 1; let listEntries: DraftListEntry[] = []; const isSame = (a: DraftListEntry, b: DraftListEntry) => a.projectPath === b.projectPath && a.draftId === b.draftId;