Skip to content

Commit

Permalink
fix: error when viewing versions if plural label is set as a function (
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpopus authored Sep 13, 2024
1 parent d0bb1c9 commit ff1c1e0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/next/src/views/Versions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const VersionsView: PayloadServerReactComponent<EditViewComponent> = asyn
i18n,
payload,
payload: { config },
t,
user,
},
} = initPageResult
Expand Down Expand Up @@ -141,13 +142,19 @@ export const VersionsView: PayloadServerReactComponent<EditViewComponent> = asyn
latestPublishedVersion: latestPublishedVersion?.id,
})

const pluralLabel = collectionConfig?.labels?.plural
? typeof collectionConfig.labels.plural === 'function'
? collectionConfig.labels.plural({ t })
: collectionConfig.labels.plural
: globalConfig?.label

return (
<React.Fragment>
<SetDocumentStepNav
collectionSlug={collectionConfig?.slug}
globalSlug={globalConfig?.slug}
id={id}
pluralLabel={collectionConfig?.labels?.plural || globalConfig?.label}
pluralLabel={pluralLabel}
useAsTitle={collectionConfig?.admin?.useAsTitle || globalConfig?.slug}
view={i18n.t('version:versions')}
/>
Expand Down

0 comments on commit ff1c1e0

Please sign in to comment.