Skip to content

When copying or saving to a locale, the localized fields in arrays or blocks of other locales lose their values #12536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
epranka opened this issue May 24, 2025 · 4 comments · May be fixed by #12601
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@epranka
Copy link

epranka commented May 24, 2025

Describe the Bug

If a collection contains arrays or blocks with localized fields, copying one locale to another or simply saving the current locale causes other locales to lose their values. It seems that localized values are not merged but instead overwritten. I am using MongoDB, so I'm not sure if this behavior is different with relational databases

Link to the code that reproduces this issue

https://github.com/epranka/payload-locales-save-issue

Reproduction Steps

  1. Clone the repository.
  2. Run docker compose up and wait until both the app and MongoDB are ready.
  3. Open http://localhost:3000/admin.
  4. Create an account.
  5. Create a new Page. Enter a title, add at least one item in an array or block with filled fields. In the Content tab, add any layout to avoid validation errors. Then, publish the page.
  6. Click "Copy to locale" and select the "en" locale.
  7. Switch back to the previous "lt" locale. You should see that the values in the array and block are lost.
  8. Click "Copy to locale" and select the "lt" locale.
  9. Switch back to the previous "en" locale. You should now see that the values are lost in that locale instead. Only the last saved locale retains its values.

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Binaries:
  Node: 20.13.1
  npm: 10.5.2
  Yarn: N/A
  pnpm: 10.11.0
Relevant Packages:
  payload: 3.39.1
  next: 15.3.0
  @payloadcms/db-mongodb: 3.39.1
  @payloadcms/email-nodemailer: 3.39.1
  @payloadcms/graphql: 3.39.1
  @payloadcms/live-preview: 3.39.1
  @payloadcms/live-preview-react: 3.39.1
  @payloadcms/next/utilities: 3.39.1
  @payloadcms/payload-cloud: 3.39.1
  @payloadcms/plugin-form-builder: 3.39.1
  @payloadcms/plugin-nested-docs: 3.39.1
  @payloadcms/plugin-redirects: 3.39.1
  @payloadcms/plugin-search: 3.39.1
  @payloadcms/plugin-seo: 3.39.1
  @payloadcms/richtext-lexical: 3.39.1
  @payloadcms/translations: 3.39.1
  @payloadcms/ui/shared: 3.39.1
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #61.1~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 18 12:20:24 UTC
  Available memory (MB): 64167
  Available CPU cores: 16
@epranka epranka added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels May 24, 2025
@github-actions github-actions bot removed the validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. label May 24, 2025
@Alief321
Copy link

Alief321 commented May 24, 2025

I also experienced this issue with postgresql in my local with payload version 3.39.1. I assume this bug appear in 3.36.0 because when i use 3.35.0 is work finely.

I dont know if this changed related but in 3.36.0 release have a change in copyToLocale to avoid duplicate
34ead72

@bramdupont
Copy link

Experienced this aswell with MongoDB!
For me it seemed to work when I published but not when creating a new document and copying in draft mode.

@anyuj
Copy link
Contributor

anyuj commented May 29, 2025

I also experienced this issue with postgresql in my local with payload version 3.39.1. I assume this bug appear in 3.36.0 because when i use 3.35.0 is work finely.

I dont know if this changed related but in 3.36.0 release have a change in copyToLocale to avoid duplicate 34ead72

The change you mentioned doesn't seem able to cause the bug. I also found the bug only happens to Arrays or Blocks field that itself is not localized enabled, but it has localized nested field inside.

@anyuj
Copy link
Contributor

anyuj commented May 30, 2025

By the way, #4195 This 'Edit multiple locales at once' feature would be a game-changer for any multi-locale website. It can streamline the workflow and solve countless localization headaches. However, not many people aware of this discussion. If you’ve ever wished you could update all your site’s languages in one go, please join me in requesting this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
4 participants