payloadcms/payload

Pagination has duplicate entries between pages when timestamps === false

Closed this issue · 8 comments

Describe the Bug

When a collection has timestamps set to false depending on the limit multiple entries from the first page are repeated on the next page or pages.

In my testing, on my collection with 229 entries, when I use a limit of 100, there are 53 items from the first page on the second page. The total still stays the same, but I don't receive all the expected items. When the limit is set to 50, items from the first page can be even found on page 3, items from the second page also.

Link to the code that reproduces this issue

https://github.com/tylkomat/payload/tree/pagination-bug

Reproduction Steps

run pnpm test:int _community

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 22.18.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.56.0
  next: 15.4.4
  @payloadcms/db-mongodb: 3.56.0
  @payloadcms/email-nodemailer: 3.56.0
  @payloadcms/graphql: 3.56.0
  @payloadcms/next/utilities: 3.56.0
  @payloadcms/richtext-lexical: 3.56.0
  @payloadcms/translations: 3.56.0
  @payloadcms/ui/shared: 3.56.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 15125
  Available CPU cores: 12

@tylkomat can you please create video for this? I want to reproduce this issue locally.

@ahtesham-quraish Did you checkout my repo and ran pnpm test:int _community? If you change timestamps to true, the test passes, on false it fails.

Here is a video, it's sorted by the ID, I also added a property to have a visualization of the order:

22.09.2025_14.29.01_REC.mp4

@tylkomat you mean your issue is fixed?

@ahtesham-quraish No, how do you come to that conclusion?

Hi @tylkomat - I'm looking into this.

In the meanwhile, I noticed that applying a sort fixes this issue. If you sort by id or another field, you should no longer see duplicate docs across pages.

The interesting thing is also that when I directly call the db via payload.db.collections['markers'].collection.find it works as expected.

🚀 This is included in version v3.57.0

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