-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Describe the Bug
Starting from next@16.2.0-canary.83, when autosave is enabled on a collection, navigating to "/create" produces two draft documents instead of one. This only occurs when deployed to Vercel.
My understanding is that this release changed how Vercel's infrastructure handles PPR for dynamic routes, turning a single function invocation into two. Since Payload creates and redirects to a draft as a side-effect during server component rendering, any of the heuristics around PPR, Suspense retries, and so on, could end up producing unwanted drafts.
I find it a bit absurd that the deployment platform has an effect on the framework behavior, but on the other hand, server components should be free of side-effects.
The problematic code is at packages/next/src/views/Document/index.tsx:331 and onward; the payload.create() call inside renderDocument.
I would imagine a temporary workaround would be to force dynamic rendering of the admin panel segments.
The Next.js-idiomatic solution would probably be to replace the "/create" navigation links with form buttons that submit a server action, that either redirects the user to the "/create" page, or creates a draft and redirects to it.
Link to the code that reproduces this issue
Sorry, I can't invest more time here, just wanted to share my findings
Reproduction Steps
- Have a collection with
versions: { drafts: { autosave: true } } next.config.tshascacheComponents: true- Deploy to Vercel
- Click "Create New" from the collection list view
- Two draft documents appear in the database
Does not reproduce with next build && next start locally, and presumably not on any other host.
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 24.12.0
npm: 11.6.2
Yarn: N/A
pnpm: 10.30.3
Relevant Packages:
payload: 3.79.0
next: 16.2.0-canary.83
@payloadcms/db-vercel-postgres: 3.79.0
@payloadcms/drizzle: 3.79.0
@payloadcms/email-resend: 3.79.0
@payloadcms/graphql: 3.79.0
@payloadcms/live-preview: 3.79.0
@payloadcms/live-preview-react: 3.79.0
@payloadcms/next/utilities: 3.79.0
@payloadcms/plugin-cloud-storage: 3.79.0
@payloadcms/plugin-form-builder: 3.79.0
@payloadcms/richtext-lexical: 3.79.0
@payloadcms/storage-vercel-blob: 3.79.0
@payloadcms/translations: 3.79.0
@payloadcms/ui/shared: 3.79.0
react: 19.2.4
react-dom: 19.2.4
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10