payloadcms/payload

Fallback locale option for arrays always resets to true after saving and displays even if array isn't required

Opened this issue · 0 comments

Describe the Bug

When using the "Fallback locale" option for array fields, the checkbox state does not persist correctly.
Even if the option is disabled (unchecked) and the document is saved, after refreshing the admin panel the checkbox always appears as checked.
On the next save, the value is stored as true, regardless of the actual intended state.

Link to the code that reproduces this issue

https://github.com/urbanczykb/fallback-locale-bug

Reproduction Steps

Configuration:

  1. Create a global with a localized array field.
  2. Do not mark that array as required
  3. In payload.config.ts set localization object with at least two languages

CMS:

  1. Go to global created in first step
  2. Observe that the fallback locale is present
  3. Switch to non-default locale in the admin panel
  4. Disable the Fallback locale option for that array.
  5. Save the document.
  6. Refresh the page (F5).
  7. Observe that the Fallback locale checkbox is checked again.
  8. Save the document once more → the value is stored as true.

Expected behavior

  1. The Fallback locale checkbox shouldn't be checked.
  2. The checkbox shouldn't be displayed according to #12396

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

area: ui

Environment Info

Payload version: 3.55.1
Database: MongoDB