Skip to content

Invalid schema usage after revert of field localisation  #838

@flaming-codes

Description

@flaming-codes

Bug Report

When creating an entity with localization: true, then changing the schema to localization: false, the stored entity becomes unusable. The locales are still stored and viewing/editing the entity becomes impossible, as now the value is a set of keys, which React can't render as children.

Expected Behavior

The default locale field value is picked for the new schema. Entities stay usable after disabling localisation for fields of saved entries.

Current Behavior

Entities become unusable after

  • storing field value in multiple locales
  • disabling localisation for the field
  • starting the CMS again and viewing the entity

Possible Solution

Default locale value gets picked in restoration process.

Steps to Reproduce

I created a repo for quick testing. All instructions are included the in the README.md.

https://github.com/flaming-codes/payload-cms-localization-collection-issue

Detailed Description

Description Image
Screenshot 2022-07-27 at 22 34 59 valid after initial save in multiple locales
Screenshot 2022-07-27 at 22 35 53 invalid, locales still present after entity is not localised anymore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions