From 46439e31bd5d5d319826e8a8b12b8a1ce42c477f Mon Sep 17 00:00:00 2001 From: Patrik Kozak Date: Thu, 30 May 2024 14:40:49 -0400 Subject: [PATCH 1/3] fix: removes sort from arrays & blocks & group fields --- .../src/admin/components/elements/SortColumn/index.tsx | 6 ++++-- .../src/admin/components/elements/SortColumn/types.ts | 1 + .../admin/components/elements/TableColumns/buildColumns.tsx | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/payload/src/admin/components/elements/SortColumn/index.tsx b/packages/payload/src/admin/components/elements/SortColumn/index.tsx index e2f90d3bfd1..c0086cda509 100644 --- a/packages/payload/src/admin/components/elements/SortColumn/index.tsx +++ b/packages/payload/src/admin/components/elements/SortColumn/index.tsx @@ -13,7 +13,7 @@ import './index.scss' const baseClass = 'sort-column' const SortColumn: React.FC = (props) => { - const { name, disable = false, label } = props + const { name, type, disable = false, label } = props const params = useSearchParams() const history = useHistory() const { i18n, t } = useTranslation('general') @@ -29,6 +29,8 @@ const SortColumn: React.FC = (props) => { const descClasses = [`${baseClass}__desc`] if (sort === desc) descClasses.push(`${baseClass}--active`) + const shouldRenderButtons = !disable && type !== 'array' && type !== 'group' && type !== 'blocks' + const setSort = useCallback( (newSort) => { history.push({ @@ -47,7 +49,7 @@ const SortColumn: React.FC = (props) => { return (
{getTranslation(label, i18n)} - {!disable && ( + {shouldRenderButtons && (