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
43 stars 11 forks source link

internationalizedArrayText crashes Studio with Error: Cannot read properties of undefined (reading 'default') #54

Closed ervibern closed 8 months ago

ervibern commented 9 months ago

Describe the bug

I created several internationalized fields in my scheme. The internationalizedArrayString works well while internationalizedArrayText results in a Studio crash.

defineField({
      name: 'title',
      title: 'Title',
      type: 'internationalizedArrayString',
      validation: (rule) => rule.required(),
    }),
defineField({
      name: 'text',
      title: 'Text',
      type: 'internationalizedArrayText',
    }),

Error: Cannot read properties of undefined (reading 'default')

In sanity.config.js, I added a plugin, like that:

internationalizedArray({
      languages: [
        {id: 'en', title: 'English'},
        {id: 'lt', title: 'Lithuanian'},
      ],
      defaultLanguages: ['en'],
      fieldTypes: ['string', 'text'],
    }),

To Reproduce

Steps to reproduce the behavior:

Setup a scheme as above and run npm run dev to open localhost.

Expected behavior

Expect both string and text fields to be internationalized.

Screenshots

image

Which versions of Sanity are you using?

@sanity/cli (global) 3.23.4 (up to date) @sanity/eslint-config-studio 3.0.1 (up to date) @sanity/vision 3.23.4 (up to date) sanity 3.23.4 (up to date)

What operating system are you using?

MacOS Ventura 13.4

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

npm: 10.2.3 node: v20.10.0

Additional context

"sanity-plugin-internationalized-array": "^1.10.3",

thomasKn commented 9 months ago

Same issue here, I think this is related to the styled-components missmatch issue (#52)

plcdnl commented 9 months ago

is there any news about it? It would be very useful to be able to use it

robinpyon commented 9 months ago

Thanks for reporting! A fix for this issue is forthcoming, and should be out in the next Sanity studio release.

michaelburtonray commented 8 months ago

is there any news about it? It would be very useful to be able to use it

@plcdnl The latest version of the Studio fixes this bug! v3.24.1 https://github.com/sanity-io/sanity/releases