From f88cef5470deb63fad6beff8c7fe318d1be71d19 Mon Sep 17 00:00:00 2001 From: Patrik Date: Mon, 12 Aug 2024 10:33:28 -0400 Subject: [PATCH] fix(ui): render singular label for `ArrayCell` when length is 1 (#7586) ## Description V2 PR [here](https://github.com/payloadcms/payload/pull/7585) - [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 - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] Existing test suite passes locally with my changes --- .../src/elements/Table/DefaultCell/fields/Array/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/elements/Table/DefaultCell/fields/Array/index.tsx b/packages/ui/src/elements/Table/DefaultCell/fields/Array/index.tsx index c5ea337da..2b027a544 100644 --- a/packages/ui/src/elements/Table/DefaultCell/fields/Array/index.tsx +++ b/packages/ui/src/elements/Table/DefaultCell/fields/Array/index.tsx @@ -15,10 +15,10 @@ export const ArrayCell: React.FC = ({ cellData, labels }) => { const arrayFields = cellData ?? [] - const label = `${arrayFields.length} ${getTranslation( - labels?.plural || i18n.t('general:rows'), - i18n, - )}` + const label = + arrayFields.length === 1 + ? `${arrayFields.length} ${getTranslation(labels?.singular || i18n.t('general:rows'), i18n)}` + : `${arrayFields.length} ${getTranslation(labels?.plural || i18n.t('general:rows'), i18n)}` return {label} }