diff --git a/packages/ui/src/elements/EditMany/index.tsx b/packages/ui/src/elements/EditMany/index.tsx index 48611df60f..addab545b4 100644 --- a/packages/ui/src/elements/EditMany/index.tsx +++ b/packages/ui/src/elements/EditMany/index.tsx @@ -14,7 +14,6 @@ import { RenderFields } from '../../forms/RenderFields/index.js' import { FormSubmit } from '../../forms/Submit/index.js' import { X } from '../../icons/X/index.js' import { useAuth } from '../../providers/Auth/index.js' -import { useComponentMap } from '../../providers/ComponentMap/index.js' import { useConfig } from '../../providers/Config/index.js' import { DocumentInfoProvider } from '../../providers/DocumentInfo/index.js' import { OperationContext } from '../../providers/Operation/index.js' diff --git a/packages/ui/src/elements/PerPage/index.tsx b/packages/ui/src/elements/PerPage/index.tsx index b216cade24..ec8e522e18 100644 --- a/packages/ui/src/elements/PerPage/index.tsx +++ b/packages/ui/src/elements/PerPage/index.tsx @@ -1,6 +1,7 @@ 'use client' // TODO: abstract the `next/navigation` dependency out from this component import { collectionDefaults } from 'payload/config' +import { isNumber } from 'payload/utilities' import React from 'react' import { Chevron } from '../../icons/Chevron/index.js' @@ -13,6 +14,7 @@ const baseClass = 'per-page' const defaultLimits = collectionDefaults.admin.pagination.limits export type PerPageProps = { + defaultLimit?: number handleChange?: (limit: number) => void limit: number limits: number[] @@ -20,18 +22,21 @@ export type PerPageProps = { } export const PerPage: React.FC = ({ + defaultLimit = 10, handleChange, limit, limits = defaultLimits, }) => { const { t } = useTranslation() + const limitToUse = isNumber(limit) ? limit : defaultLimit + return (
- {t('general:perPage', { limit })} + {t('general:perPage', { limit: limitToUse })}  
@@ -43,7 +48,7 @@ export const PerPage: React.FC = ({ = ({ if (handleChange) handleChange(limitNumber) }} > - {limitNumber === Number(limit) && ( + {limitNumber === limitToUse && (
diff --git a/test/admin/e2e.spec.ts b/test/admin/e2e.spec.ts index 03da84468f..e85a2c23d7 100644 --- a/test/admin/e2e.spec.ts +++ b/test/admin/e2e.spec.ts @@ -410,6 +410,8 @@ describe('admin', () => { }) test('global - should render custom, localized label', async () => { + await page.goto(postsUrl.admin) + await page.waitForURL(postsUrl.admin) await openNav(page) const label = 'My Global Label' const globalLabel = page.locator(`#nav-global-global`) @@ -420,6 +422,8 @@ describe('admin', () => { }) test('global - should render simple label strings', async () => { + await page.goto(postsUrl.admin) + await page.waitForURL(postsUrl.admin) await openNav(page) const label = 'Group Globals 1' const globalLabel = page.locator(`#nav-global-group-globals-one`) @@ -431,6 +435,8 @@ describe('admin', () => { }) test('global - should render slug in sentence case as fallback', async () => { + await page.goto(postsUrl.admin) + await page.waitForURL(postsUrl.admin) await openNav(page) const label = 'Group Globals Two' const globalLabel = page.locator(`#nav-global-group-globals-two`) @@ -1133,9 +1139,9 @@ describe('admin', () => { // delete all posts created by the seed await deleteAllPosts() - await mapAsync([...Array(3)], async () => { - await createPost() - }) + await createPost() + await createPost() + await createPost() }) test('should select multiple rows', async () => {