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
handleStaleDataCheck drops the incoming request, so access functions that read headers or cookies refuse it and the "Document modified" warning never shows #19981
handleStaleDataCheck (packages/ui/src/utilities/handleStaleDataCheck.ts) calls req.payload.findByID / req.payload.findGlobal with overrideAccess: false, user: req.user but without req. The Local API then builds a fresh request with empty headers (createLocalReq), so any read access function that looks at the incoming request's cookies or headers (for example a second-factor check stored in a cookie) returns false. executeAccess throws Forbidden, the check logs Error checking for stale data: Forbidden You are not allowed to perform this action., and returns isStale: false, so DocumentStaleData never shows.
The same request passed canAccessAdmin moments earlier in buildFormStateHandler, so it is only the dropped req that fails.
Link to the code that can reproduce this issue
(none public: a minimal repro below)
Reproduction Steps
A collection or global whose read access returns Boolean(req.user) && req.headers.get('cookie')?.includes('mark=1').
Sign in and set the mark=1 cookie; open an existing document's edit view in two tabs.
Save in tab 1; type in tab 2.
Expected: the "Document modified" modal in tab 2. Actual: no modal; the server logs Error checking for stale data: Forbidden ….
Fix
Pass the incoming request instead of only its user, in both branches:
- user: req.user+ req
We run this as a local patch on @payloadcms/ui 3.93.0 with a database test; the warning shows and no error is logged. 3.94.2 and main (read 2026-11-26) have the same call.
Activity