Skip to content

Commit

Permalink
fix: draftId correct set in timeline for version docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Aug 29, 2024
1 parent 7a9c9f5 commit 5cff65b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
type Chunk,
DRAFTS_FOLDER,
getVersionId,
isVersionId,
remoteSnapshots,
type RemoteSnapshotVersionEvent,
type SelectionState,
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 5cff65b

Please sign in to comment.