payload icon indicating copy to clipboard operation
payload copied to clipboard

beforeOperation hook not called for findVersions operation

Open jhb-dev opened this issue 4 months ago • 1 comments

Describe the Bug

The beforeOperation collection hook is not being called when using the findVersions operation, while it correctly triggers for normal find operations. This is inconsistent behavior - all operations should trigger beforeOperation hooks.

Expected Behavior

Both operations should trigger the beforeOperation hook:

  • payload.find()beforeOperation hook called ✓
  • payload.findVersions()beforeOperation hook called ✓

Actual Behavior

Only find triggers the hook:

  • payload.find()beforeOperation hook called ✓
  • payload.findVersions()beforeOperation hook NOT called ✗

Link to the code that reproduces this issue

https://github.com/jhb-dev/payload-find-versions-before-operation-hook-issue

Reproduction Steps

  1. Clone the reproduction repository
  2. Start the Payload dev server with pnpm dev and open it in your browser.
  3. Check the server console for the reproduction.

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

area: core

Environment Info

Binaries:
  Node: 24.3.0
  npm: 11.4.2
  pnpm: 10.12.4
Relevant Packages:
  payload: 3.64.0
  next: 15.4.7
  @payloadcms/db-mongodb: 3.64.0
  @payloadcms/richtext-lexical: 3.64.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: darwin
  Arch: arm64

jhb-dev avatar Nov 25 '25 06:11 jhb-dev

During a discussion with r1tsuu in the Discord, he noticed that the afterOperation hook is also not called for find operations.

jhb-dev avatar Nov 28 '25 15:11 jhb-dev

🚀 This is included in version v3.67.0

github-actions[bot] avatar Dec 05 '25 20:12 github-actions[bot]

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

github-actions[bot] avatar Dec 13 '25 05:12 github-actions[bot]