payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.5k stars 1.55k forks source link

Changing a non-localized field on a versions-enabled collection resets localized fields to the default locale values #2878

Closed hdodov closed 1 year ago

hdodov commented 1 year ago

Link to reproduction

https://github.com/hdodov/payload/tree/bug-original-content-on-save

To Reproduce

Prerequisites:

Reproduction:

  1. Create an entry in the default locale
  2. Fill in both the translatable and untranslatable fields
  3. Switch over to the second locale
  4. Change the translatable field to something else
  5. Switch back to the default locale
  6. Change the untranslatable field to something else
  7. Switch to the second locale once again
  8. Refresh the page
  9. The translatable field on the second locale is reset to the value in the default locale

Describe the Bug

Changing untranslatable fields should not reset other fields to the default locale values.

I've demonstrated this in the following video:

https://github.com/payloadcms/payload/assets/5570098/7b531a24-14e7-4be4-8ad8-2c6f5310c3fe

In the video, I have:

As per the reproduction steps, the following happens:

  1. I create a post
  2. In the English version, I set content to "english" and slug to "test"
  3. In the Spanish version, I set content to "spanish"
  4. In the English version, I set slug to "test another"
  5. In the Spanish version, the content is reset to "english" upon refreshing the page, rather than remaining "spanish"

The issue appears to come from the versions functionality. Without versions and drafts enabled, I wasn't able to reproduce this.

Payload Version

1.10.0

hdodov commented 1 year ago

@jmikrut I'm going to allow myself to tag you in because I think that's a pretty big issue, since content is getting lost.

jmikrut commented 1 year ago

Hey @hdodov—thanks for the issue report. We are on this immediately. Expect an answer back shortly!

hdodov commented 1 year ago

Just letting you know that I updated Payload and the issue is resolved indeed. Thank you very much!

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.