Skip to content

Commit 5ef2951

Browse files
authored
fix: formats locales for version comparison view (#7433)
Closes #7381
1 parent a943487 commit 5ef2951

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
8181

8282
const canUpdate = docPermissions?.update?.permission
8383

84+
const localeValues = locales.map((locale) => locale.value)
85+
8486
return (
8587
<main className={baseClass}>
8688
<SetViewActions actions={componentMap?.actionsMap?.Edit?.Version} />
@@ -136,11 +138,7 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
136138
fieldMap={fieldMap}
137139
fieldPermissions={docPermissions?.fields}
138140
i18n={i18n}
139-
locales={
140-
locales
141-
? locales.map(({ label }) => (typeof label === 'string' ? label : undefined))
142-
: []
143-
}
141+
locales={localeValues}
144142
version={
145143
globalConfig
146144
? {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ export const VersionView: EditViewComponent = async (props) => {
9999

100100
const localeOptions: OptionObject[] =
101101
localization &&
102-
localization?.locales &&
103102
localization.locales.map(({ code, label }) => ({
104-
label: typeof label === 'string' ? label : '',
103+
label,
105104
value: code,
106105
}))
107106

0 commit comments

Comments
 (0)