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
41 stars 10 forks source link

`select` does not select fields #71

Open dmnkgrc opened 1 month ago

dmnkgrc commented 1 month ago

Describe the bug

When I add keys to the select object they are not selected. Regardless of what I try to select, the object is emply.

To Reproduce

My configuration looks like this:

    internationalizedArray({
        select: {
            market: "market",
            marketKey: "marketKey",
            availableMarkets: "availableMarkets",
        },
        languages: async (client, data) => {
                         // Added this to debug for now
            console.log("[data]", JSON.stringify(data));
            return supportedLanguages;
        },
        fieldTypes: ["string", "content"],
    })

The document I am trying to edit has the following fields:

[
   ....
    {
      name: 'market',
      type: 'marketKey',
      validation: (Rule) => Rule.required(),
    },
    {
      name: 'content',
      // I also tried string here
      type: 'internationalizedArrayContent',
    },
    ...
  ]

Nevertheless, in the console I only see: [data] {} being logged

Expected behavior

In this case, I would expect market to be present in the object, but it is not.

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

@sanity/cli (global)     3.42.1 (latest: 3.43.0)
@sanity/assist            3.0.4 (up to date)
@sanity/cli              3.42.1 (latest: 3.43.0)
@sanity/dashboard         3.1.6 (up to date)
@sanity/icons            2.11.8 (up to date)
@sanity/image-url         1.0.2 (up to date)
@sanity/language-filter   4.0.2 (up to date)
@sanity/types            3.42.1 (latest: 3.43.0)
@sanity/ui               2.1.10 (latest: 2.1.11)
@sanity/vision           3.42.1 (latest: 3.43.0)
sanity                   3.42.1 (latest: 3.43.0)

What operating system are you using?

MacOS Sonoma

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

pnpm 8.15.6

Node 20.10.0