Skip to content

Commit 8a48941

Browse files
authored
fix(next): incorrect version view stepnav value (#13305)
Previously, the version view stepnav incorrectly displayed the version ID instead of the parent document ID in the navigation. It also incorrectly pulled the field value if `useAsTitle` was set, displayed the `[undefined]` instead. **Edit View:** <img width="2218" height="244" alt="Screenshot 2025-07-28 at 16 55 26@2x" src="https://github.com/user-attachments/assets/7b144480-ec5a-4592-b603-09e1e35bd558" /> ## Version View - Before: <img width="2280" height="378" alt="Screenshot 2025-07-28 at 16 56 02@2x" src="https://github.com/user-attachments/assets/8b79bab3-a79b-4930-ade1-2da450f00fc7" /> ## Version View - After: **Version View:** <img width="2222" height="358" alt="Screenshot 2025-07-28 at 16 55 46@2x" src="https://github.com/user-attachments/assets/bb0fffbb-c3e6-419f-ad72-5731e85059cc" /> --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1210907527783756
1 parent 095e7d9 commit 8a48941

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/next/src/views/Version/Default/SetStepNav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const SetStepNav: React.FC<{
1515
readonly isTrashed?: boolean
1616
versionToCreatedAtFormatted?: string
1717
versionToID?: string
18-
versionToUseAsTitle?: string
18+
versionToUseAsTitle?: Record<string, string> | string
1919
}> = ({
2020
id,
2121
collectionConfig,
@@ -54,7 +54,7 @@ export const SetStepNav: React.FC<{
5454
? versionToUseAsTitle?.[locale.code] || docLabel
5555
: versionToUseAsTitle
5656
} else if (useAsTitle === 'id') {
57-
docLabel = versionToID
57+
docLabel = String(id)
5858
}
5959

6060
const docBasePath: `/${string}` = isTrashed

packages/next/src/views/Version/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ export async function VersionView(props: DocumentViewServerProps) {
411411
})
412412
}
413413

414+
const useAsTitleFieldName = collectionConfig?.admin?.useAsTitle || 'id'
415+
const versionToUseAsTitle =
416+
useAsTitleFieldName === 'id'
417+
? String(versionTo.parent)
418+
: versionTo.version?.[useAsTitleFieldName]
414419
return (
415420
<DefaultVersionView
416421
canUpdate={docPermissions?.update}
@@ -425,7 +430,7 @@ export async function VersionView(props: DocumentViewServerProps) {
425430
VersionToCreatedAtLabel={formatPill({ doc: versionTo, labelStyle: 'pill' })}
426431
versionToID={versionTo.id}
427432
versionToStatus={versionTo.version?._status}
428-
versionToUseAsTitle={versionTo[collectionConfig?.admin?.useAsTitle || 'id']}
433+
versionToUseAsTitle={versionToUseAsTitle}
429434
/>
430435
)
431436
}

0 commit comments

Comments
 (0)