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
This commit is contained in:
@@ -15,7 +15,7 @@ export const SetStepNav: React.FC<{
|
|||||||
readonly isTrashed?: boolean
|
readonly isTrashed?: boolean
|
||||||
versionToCreatedAtFormatted?: string
|
versionToCreatedAtFormatted?: string
|
||||||
versionToID?: string
|
versionToID?: string
|
||||||
versionToUseAsTitle?: string
|
versionToUseAsTitle?: Record<string, string> | string
|
||||||
}> = ({
|
}> = ({
|
||||||
id,
|
id,
|
||||||
collectionConfig,
|
collectionConfig,
|
||||||
@@ -54,7 +54,7 @@ export const SetStepNav: React.FC<{
|
|||||||
? versionToUseAsTitle?.[locale.code] || docLabel
|
? versionToUseAsTitle?.[locale.code] || docLabel
|
||||||
: versionToUseAsTitle
|
: versionToUseAsTitle
|
||||||
} else if (useAsTitle === 'id') {
|
} else if (useAsTitle === 'id') {
|
||||||
docLabel = versionToID
|
docLabel = String(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const docBasePath: `/${string}` = isTrashed
|
const docBasePath: `/${string}` = isTrashed
|
||||||
|
|||||||
@@ -411,6 +411,11 @@ export async function VersionView(props: DocumentViewServerProps) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const useAsTitleFieldName = collectionConfig?.admin?.useAsTitle || 'id'
|
||||||
|
const versionToUseAsTitle =
|
||||||
|
useAsTitleFieldName === 'id'
|
||||||
|
? String(versionTo.parent)
|
||||||
|
: versionTo.version?.[useAsTitleFieldName]
|
||||||
return (
|
return (
|
||||||
<DefaultVersionView
|
<DefaultVersionView
|
||||||
canUpdate={docPermissions?.update}
|
canUpdate={docPermissions?.update}
|
||||||
@@ -425,7 +430,7 @@ export async function VersionView(props: DocumentViewServerProps) {
|
|||||||
VersionToCreatedAtLabel={formatPill({ doc: versionTo, labelStyle: 'pill' })}
|
VersionToCreatedAtLabel={formatPill({ doc: versionTo, labelStyle: 'pill' })}
|
||||||
versionToID={versionTo.id}
|
versionToID={versionTo.id}
|
||||||
versionToStatus={versionTo.version?._status}
|
versionToStatus={versionTo.version?._status}
|
||||||
versionToUseAsTitle={versionTo[collectionConfig?.admin?.useAsTitle || 'id']}
|
versionToUseAsTitle={versionToUseAsTitle}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user