diff --git a/packages/sanity/src/core/releases/tool/components/Table/types.ts b/packages/sanity/src/core/releases/tool/components/Table/types.ts index 690f56cfb1a..6f1e22b91d7 100644 --- a/packages/sanity/src/core/releases/tool/components/Table/types.ts +++ b/packages/sanity/src/core/releases/tool/components/Table/types.ts @@ -17,7 +17,7 @@ export interface Column { width: number | null style?: CSSProperties sorting?: boolean - sortTransform?: (value: TableData) => number + sortTransform?: (value: TableData) => number | string } export interface TableHeaderProps { diff --git a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseSummary.test.tsx b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseSummary.test.tsx index 1da5bf1cf8a..1c6f00e03dd 100644 --- a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseSummary.test.tsx +++ b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseSummary.test.tsx @@ -62,6 +62,7 @@ const releaseDocuments: DocumentInRelease[] = [ memoKey: '456', document: { ...documentsInRelease.document, + _updatedAt: new Date().toISOString(), _id: '456', _rev: 'abc', title: 'Second document', @@ -210,7 +211,6 @@ describe('ReleaseSummary', () => { within(sortedCreatedAscFirstDocument).getByText('Second document') within(sortedCreatedAscSecondDocument).getByText('First document') - fireEvent.click(within(screen.getByRole('table')).getByText('Edited')) fireEvent.click(within(screen.getByRole('table')).getByText('Edited')) const [sortedEditedDescFirstDocument, sortedEditedDescSecondDocument] = diff --git a/packages/sanity/src/core/releases/tool/detail/documentTable/DocumentTableColumnDefs.tsx b/packages/sanity/src/core/releases/tool/detail/documentTable/DocumentTableColumnDefs.tsx index 103a576d6e1..5bac2c6b341 100644 --- a/packages/sanity/src/core/releases/tool/detail/documentTable/DocumentTableColumnDefs.tsx +++ b/packages/sanity/src/core/releases/tool/detail/documentTable/DocumentTableColumnDefs.tsx @@ -94,6 +94,9 @@ export const getDocumentTableColumnDefs: ( id: 'search', width: null, style: {minWidth: '50%', maxWidth: '50%'}, + sortTransform(value) { + return value.previewValues.values.title?.toLowerCase() || 0 + }, header: (props) => ( ),