diff --git a/packages/sanity/src/core/store/_legacy/history/history/Timeline.ts b/packages/sanity/src/core/store/_legacy/history/history/Timeline.ts index 59d7cfa44f40..2109333320da 100644 --- a/packages/sanity/src/core/store/_legacy/history/history/Timeline.ts +++ b/packages/sanity/src/core/store/_legacy/history/history/Timeline.ts @@ -1,6 +1,7 @@ import {type Diff} from '@sanity/diff' import {type TransactionLogEventWithEffects} from '@sanity/types' import {applyPatch, incremental} from 'mendoza' +import {isVersionId} from 'sanity' import {type Annotation, type Chunk} from '../../../../field' import {chunkFromTransaction, mergeChunk} from './chunker' @@ -60,7 +61,7 @@ export class Timeline { constructor(opts: TimelineOptions) { this.publishedId = opts.publishedId - this.draftId = `drafts.${opts.publishedId}` + this.draftId = isVersionId(opts.publishedId) ? opts.publishedId : `drafts.${opts.publishedId}` if (opts.enableTrace) { this._trace = [] diff --git a/packages/sanity/src/core/store/_legacy/history/useTimelineStore.ts b/packages/sanity/src/core/store/_legacy/history/useTimelineStore.ts index 07c34cf1fbbf..160c1364d028 100644 --- a/packages/sanity/src/core/store/_legacy/history/useTimelineStore.ts +++ b/packages/sanity/src/core/store/_legacy/history/useTimelineStore.ts @@ -18,7 +18,6 @@ import { type Chunk, DRAFTS_FOLDER, getVersionId, - isVersionId, remoteSnapshots, type RemoteSnapshotVersionEvent, type SelectionState, @@ -119,8 +118,7 @@ export function useTimelineStore({ () => historyStore.getTimelineController({ client, - documentId: - isVersionId(documentId) && version ? getVersionId(documentId, version) : documentId, + documentId: version ? getVersionId(documentId, version) : documentId, documentType, }), [client, documentId, documentType, historyStore, version],