Skip to content

Commit cdb2072

Browse files
authored
fix: error thrown in version view when localization is false (#7502)
## Description `const localeValues = locales.map((locale) => locale.value)` This line was previously throwing an error in the version view when localization is false. Changed to ensure locales exist before mapping over them. - [X] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [ ] Chore (non-breaking change which does not add functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Change to the [templates](https://github.com/payloadcms/payload/tree/main/templates) directory (does not affect core functionality) - [ ] Change to the [examples](https://github.com/payloadcms/payload/tree/main/examples) directory (does not affect core functionality) - [ ] This change requires a documentation update ## Checklist: - [ ] I have added tests that prove my fix is effective or that my feature works - [X] Existing test suite passes locally with my changes - [ ] I have made corresponding changes to the documentation
1 parent 68553ff commit cdb2072

File tree

1 file changed

+1
-1
lines changed
  • packages/next/src/views/Version/Default

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
8181

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

84-
const localeValues = locales.map((locale) => locale.value)
84+
const localeValues = locales && locales.map((locale) => locale.value)
8585

8686
return (
8787
<main className={baseClass}>

0 commit comments

Comments
 (0)