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
For now, the times the future publish will get used is not worth the development effort so we are just creating so we do not forget
Summary
When a user sets a future publishedAt date on a document (posts & pages) our on-demand revalidation system can leave that document's path stuck serving a cached 404 even after publishedAt passes and the document should be live. The path only recovers via the 1-hour time-based ISR fallback, which means scheduled publishing is effectively up to 1 hour late.
A user saves a post with publishedAt set in the future.
The save fires our revalidation hook (e.g. revalidatePost.ts). At that moment the post is not considered published (its publishedAt is in the future), so the path is revalidated to a non-published / 404 state and that 404 gets cached.
The clock passes publishedAt. The document is now logically published — but no event fires. Nothing tells Next.js to revalidate the path.
The cached 404 keeps being served. SWR does not help here because the 404 response itself is cached, so subsequent visitors continue to get the stale 404.
The path only self-corrects when the 1-hour time-based revalidation (ISR) safety net kicks in. Net effect: scheduled publishing is always up to ~1 hour behind the intended publish time.
This affects any routable collection that combines a future publishedAt with on-demand revalidation — currently posts, pages, homePages (see docs/revalidation.md → Routable Collections).
Proposed solution
Use Payload's scheduled publish feature, which is built on Payload's Jobs Queue. At the scheduled publish time, the job modifies the document, which fires our existing afterChange revalidation hooks. This correctly revalidates the path right when the content goes live, instead of waiting for the ISR fallback.
This requires standing up the Jobs Queue in this project (not currently configured).
Notes/ TODOs
Payload Jobs Queue is configured in the project
Scheduled publish via publishedAt triggers on-demand revalidation at publish time (not via the 1-hour ISR fallback)
A document with a future publishedAt becomes reachable at its path within a small tolerance of publishedAt, with no stale cached 404
Behavior verified for all routable collections (posts, pages, homePages)
The existing 1-hour ISR fallback should remain as a safety net.
Note
For now, the times the future publish will get used is not worth the development effort so we are just creating so we do not forget
Summary
When a user sets a future
publishedAtdate on a document (posts & pages) our on-demand revalidation system can leave that document's path stuck serving a cached 404 even afterpublishedAtpasses and the document should be live. The path only recovers via the 1-hour time-based ISR fallback, which means scheduled publishing is effectively up to 1 hour late.Originally raised in NWACus/web#1122
(comment).
The problem
publishedAtset in the future.revalidatePost.ts). At that moment the post is not considered published (itspublishedAtis in the future), so the path is revalidated to a non-published / 404 state and that 404 gets cached.publishedAt. The document is now logically published — but no event fires. Nothing tells Next.js to revalidate the path.This affects any routable collection that combines a future
publishedAtwith on-demand revalidation — currentlyposts,pages,homePages(seedocs/revalidation.md→ Routable Collections).Proposed solution
Use Payload's scheduled publish feature, which is built on Payload's Jobs Queue. At the scheduled publish time, the job modifies the document, which fires our existing
afterChangerevalidation hooks. This correctly revalidates the path right when the content goes live, instead of waiting for the ISR fallback.This requires standing up the Jobs Queue in this project (not currently configured).
Notes/ TODOs
publishedAttriggers on-demand revalidation at publish time (not via the 1-hour ISR fallback)publishedAtbecomes reachable at its path within a small tolerance ofpublishedAt, with no stale cached 404posts,pages,homePages)