diff --git a/packages/ui/src/elements/RelationshipTable/index.tsx b/packages/ui/src/elements/RelationshipTable/index.tsx index 3247dd3c94..79f998188f 100644 --- a/packages/ui/src/elements/RelationshipTable/index.tsx +++ b/packages/ui/src/elements/RelationshipTable/index.tsx @@ -335,6 +335,7 @@ export const RelationshipTable: React.FC = (pro defaultLimit={ field.defaultLimit ?? collectionConfig?.admin?.pagination?.defaultLimit } + defaultSort={field.defaultSort ?? collectionConfig?.defaultSort} modifySearchParams={false} onQueryChange={setQuery} orderableFieldName={ diff --git a/packages/ui/src/providers/ListQuery/index.tsx b/packages/ui/src/providers/ListQuery/index.tsx index 62a55dac86..53eee2fc72 100644 --- a/packages/ui/src/providers/ListQuery/index.tsx +++ b/packages/ui/src/providers/ListQuery/index.tsx @@ -48,7 +48,10 @@ export const ListQueryProvider: React.FC = ({ if (modifySearchParams) { return searchParams } else { - return {} + return { + limit: String(defaultLimit), + sort: defaultSort, + } } }) diff --git a/test/sort/e2e.spec.ts b/test/sort/e2e.spec.ts index fdc53d19dc..f8a0421378 100644 --- a/test/sort/e2e.spec.ts +++ b/test/sort/e2e.spec.ts @@ -82,19 +82,15 @@ describe('Sort functionality', () => { await page.getByText('Join A').click() await expect(page.locator('.sort-header button')).toHaveCount(2) - await page.locator('.sort-header button').nth(0).click() await assertRows(0, 'A', 'B', 'C', 'D') await moveRow(2, 3, 'success', 0) // move to middle await assertRows(0, 'A', 'C', 'B', 'D') - await page.locator('.sort-header button').nth(1).click() await assertRows(1, 'A', 'B', 'C', 'D') await moveRow(1, 4, 'success', 1) // move to end await assertRows(1, 'B', 'C', 'D', 'A') await page.reload() - await page.locator('.sort-header button').nth(0).click() - await page.locator('.sort-header button').nth(1).click() await assertRows(0, 'A', 'C', 'B', 'D') await assertRows(1, 'B', 'C', 'D', 'A') })