Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/browser/stories/mocks/drafts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +35,6 @@ interface StoredDraft {
export function createMockDraftsApi() {
const drafts = new Map<string, StoredDraft>();
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;
Expand Down
Loading