payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
25.77k stars 1.64k forks source link

Collection config: pagination defaultLimit is ignored #7951

Closed bmamouri closed 2 months ago

bmamouri commented 2 months ago

Link to reproduction

No response

Environment Info

Node.js v18.20.4

Binaries:
  Node: 18.20.4
  npm: 10.7.0
  Yarn: 4.4.1
  pnpm: N/A
Relevant Packages:
  payload: 3.0.0-beta.95
  next: 15.0.0-canary.134
  @payloadcms/db-postgres: 3.0.0-beta.95
  @payloadcms/email-nodemailer: 3.0.0-beta.95
  @payloadcms/graphql: 3.0.0-beta.95
  @payloadcms/next/utilities: 3.0.0-beta.95
  @payloadcms/plugin-cloud: 3.0.0-beta.95
  @payloadcms/plugin-cloud-storage: 3.0.0-beta.95
  @payloadcms/richtext-lexical: 3.0.0-beta.95
  @payloadcms/richtext-slate: 3.0.0-beta.95
  @payloadcms/translations: 3.0.0-beta.95
  @payloadcms/ui/shared: 3.0.0-beta.95
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8

Describe the Bug

The admin is ignoring "pagination.defaultLimit" entirely.

This is an example collection that have a defaultLimit which is ignored in the admin page.

export const Category: CollectionConfig = {
  slug: 'category',
  admin: {
    pagination: {
      defaultLimit: 1000,
    },
  },
  fields: [
    {
      name: 'code',
      type: 'text',
      required: true,
      unique: true,
    }
  ]
}

Reproduction Steps

Create a collection with defaultLimit set to a number greater than 10.

Go to admin page and the collection page, and you will notice that each page is still showing 10 items per page.

Adapters and Plugins

No response

paulpopus commented 2 months ago

This works for me, you likely forgot to set the limits available as it needs to be one of the valid options:


pagination: {
      limits: [10, 13, 1000],
      defaultLimit: 1000,
    },

Let me know if this works for you on the latest beta

github-actions[bot] commented 2 months ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.