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
Describe the Bug
Description
When using localization with
fallback: truetogether withdraftsandautosave, 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