sanity-io / sanity-plugin-internationalized-array

A plugin to register array fields with a custom input component to store field values in multiple languages, queryable by using the language ID as an array `_key`.
MIT License
45 stars 11 forks source link

Change in behavior of defaultLanguages starting in Studio 3.57.4 #86

Open clinejj opened 2 weeks ago

clinejj commented 2 weeks ago

Describe the bug

Starting with Sanity Studio 3.57.4, there was a change in behavior to how defaultLanguages is handled within the editor.

This caused issues with our configuration, as we had a custom object that was configured as an internationalized object, which had a required field. Since we could no longer remove the object, we were unable to publish the document since the required sub-field had to be filled out.

This behavior can be reverted by removing the defaultLanguages key from the plugin configuration.

To Reproduce Using the following plugin configuration:

internationalizedArray({
  languages: [
    { id: "en-us", title: "English (United States)" },
    { id: "es-us", title: "Spanish (United States)" },
  ],
  defaultLanguages: ["en-us"],
  fieldTypes: [
    "string",
    },
  ],
}),

with a document that has a reference to internationalizedArrayString like so:

{
  title: "Test Text",
  name: "testText",
  type: "internationalizedString",
}

Steps to reproduce the behavior:

  1. Go to edit the document
  2. Click on the "remove" button next to the en-us text
  3. See the text is unable to be removed

Expected behavior

I should be able to remove any/all properties of the internationalizedArray

Screenshots 3.57.3 - notice there is no object defined

3 57 3 - able to remove image reference

3.57.4 - notice there is an object defined for en-us, however clicking the remove button next to the asset does nothing

3 57 4 - unable to remove image reference

Which versions of Sanity are you using?

This is done when updating to 3.57.4 or higher

What operating system are you using?

MacOS 15.1

Which versions of Node.js / npm are you running?

21.5.0

mplingen commented 6 days ago

We're actually encountering the exact same issue!!