fix: pass id to delete access control on soft delete in updateByID#17453
Closed
vansh17June wants to merge 1 commit into
Closed
fix: pass id to delete access control on soft delete in updateByID#17453vansh17June wants to merge 1 commit into
vansh17June wants to merge 1 commit into
Conversation
vansh17June
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
July 22, 2026 18:58
vansh17June
force-pushed
the
fix/delete-access-missing-id
branch
from
July 22, 2026 19:10
0025c80 to
4550b08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes a missing
idin theaccess.deletecontrol callback when a document is soft-deleted (trashed) via theupdateByIDoperation.Why?
When a collection has
trash: true, soft-deleting a document goes through theupdateByIDoperation. Theaccess.updatecallback correctly receives{ id, data, req }, but theaccess.deletecallback (called right below it for the trash check) only received{ data, req }—idwas missing. This makes it impossible for adeleteaccess control function to reliably identify which document is being trashed, forcing developers to rely ondata.deletedAtalone, which is poor DX and was already flagged as confusing in the linked issue.How?
One-line fix in
packages/payload/src/collections/operations/updateByID.ts—idwas already destructured and in scope at that point in the function, so it just needed to be passed through:Fixes #17452