File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
packages/next/src/views/Version Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const SetStepNav: React.FC<{
15
15
readonly isTrashed ?: boolean
16
16
versionToCreatedAtFormatted ?: string
17
17
versionToID ?: string
18
- versionToUseAsTitle ?: string
18
+ versionToUseAsTitle ?: Record < string , string > | string
19
19
} > = ( {
20
20
id,
21
21
collectionConfig,
@@ -54,7 +54,7 @@ export const SetStepNav: React.FC<{
54
54
? versionToUseAsTitle ?. [ locale . code ] || docLabel
55
55
: versionToUseAsTitle
56
56
} else if ( useAsTitle === 'id' ) {
57
- docLabel = versionToID
57
+ docLabel = String ( id )
58
58
}
59
59
60
60
const docBasePath : `/${string } ` = isTrashed
Original file line number Diff line number Diff line change @@ -411,6 +411,11 @@ export async function VersionView(props: DocumentViewServerProps) {
411
411
} )
412
412
}
413
413
414
+ const useAsTitleFieldName = collectionConfig ?. admin ?. useAsTitle || 'id'
415
+ const versionToUseAsTitle =
416
+ useAsTitleFieldName === 'id'
417
+ ? String ( versionTo . parent )
418
+ : versionTo . version ?. [ useAsTitleFieldName ]
414
419
return (
415
420
< DefaultVersionView
416
421
canUpdate = { docPermissions ?. update }
@@ -425,7 +430,7 @@ export async function VersionView(props: DocumentViewServerProps) {
425
430
VersionToCreatedAtLabel = { formatPill ( { doc : versionTo , labelStyle : 'pill' } ) }
426
431
versionToID = { versionTo . id }
427
432
versionToStatus = { versionTo . version ?. _status }
428
- versionToUseAsTitle = { versionTo [ collectionConfig ?. admin ?. useAsTitle || 'id' ] }
433
+ versionToUseAsTitle = { versionToUseAsTitle }
429
434
/>
430
435
)
431
436
}
You can’t perform that action at this time.
0 commit comments