You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hierarchy: afterRead hook uses doc._status instead of request draft intent when computing paths #17223
In packages/payload/src/hierarchy/hooks/collectionAfterRead.ts, the draft flag passed to computePaths is derived from the document's own _status:
draft: doc._status==='draft',
This is incorrect. doc._status reflects whether this specific document has unpublished changes — it does not reflect the request's draft intent (e.g. draft: true in the local API or ?draft=true in the REST API / live preview).
Broken scenario:
Parent page: published slug "about", draft slug "about-us" (draft saved but not published)
Child page: no pending draft changes → _status: 'published'
User opens child in live preview (draft: true)
doc._status === 'draft' is false for the child → computePaths receives draft: false → fetches the published parent → breadcrumb shows "about/child" instead of "about-us/child"
The user is in draft/preview mode and expects the entire path tree to reflect draft state, but doc._status only tells you about the document itself, not the request's intent.
The root cause is that draft is not currently available as a hook argument, so there is no clean way to derive the request's draft intent from within afterRead. A proper fix requires exposing draft in the hook args — see: #16180
Activity
chore: address six more Payload reports and prepare the fork PR
fix: address 24 Payload read, schema, version and tooling reports (#9)