Skip to content

payload-revalidate — Optimization

Hooks enqueue targets per transaction and return immediately. Never call flush() or send() inside a collection or global hook; flush() deadlocks until the 5000 ms wait cap expires, and send() posts before transaction commit and throws on failure.

For bulk updates or deletes, pass context: { skipRevalidate: true } to suppress per-document hooks and the 5000 ms transaction wait cap, then call await revalidator.send({ tags, paths }) once after the owning transaction commits.

Because a save in one locale can stale other locales via non-localized fields, emit tags across ctx.locales using a non-localized identifier such as doc.id, and share a single as const CACHE_TAGS map between Payload and Next.js.

Avoid maxPerDoc: 1 on versioned collections

Section titled “Avoid maxPerDoc: 1 on versioned collections”

Recovering the prior published snapshot when previousDoc is a draft requires at least two retained versions. Keep versions.maxPerDoc above 1 on collections and globals that use drafts.

Package guidance · Implementation · Matching skill.