payloadcms / payloadcms/payload

localization.fallback: true causes cross-locale draft leakage with autosave enabled

Open
#15,664 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug invalid-reproduction stale status: needs-triage
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

Description

When using localization with fallback: true together with drafts and autosave, values from the default locale are written into other locales after switching locale and triggering autosave.

This results in cross-locale data leakage between drafts.

Config

localization: {
locales: ['en', 'de'],
defaultLocale: 'en',
fallback: true,
},

versions: {
drafts: true,
},

admin: {
autoSave: true,
}

Expected behavior

With fallback: true, values from the default locale should only be used for read-time resolution.
They should not be written into other locales when saving drafts.

Actual behavior

The fallback value is returned by the API and then written back during autosave, effectively copying default locale content into other locales.

Notes

Setting fallback: false prevents this behavior.

This suggests that fallback resolution is applied before draft persistence and autosave writes back the resolved value instead of the raw stored value.

Link to the code that reproduces this issue
Reproduction Steps

Create a document in en

Enter a value in a localized field (e.g. title = "Hello")

Wait for autosave (draft created)

Switch locale to de

Localized fields appear empty in UI (expected)

Type a single character in de to trigger autosave

After autosave completes, the en value appears in de

Which area(s) are affected?

Not sure

Environment Info
Payload v3.74.0  
Next.js 15 (App Router)  
MongoDB adapter

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or code entry point is identified; start by reproducing the listed en/de locale switch and autosave sequence with fallback, drafts, and the MongoDB adapter. Compare the stored localized values before and after the de autosave, and consider the issue done when fallback values remain read-only and are not copied into another locale.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, nextjs, typescript
Domain
backend, database, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.