sanity-plugin-internationalized-array 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-internationalized-array",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Store localized fields in an array to save on attributes",
5
5
  "keywords": [
6
6
  "sanity",
@@ -1,10 +1,4 @@
1
- import {
2
- isArraySchemaType,
3
- isDocumentSchemaType,
4
- ObjectField,
5
- Path,
6
- SchemaType,
7
- } from 'sanity'
1
+ import {isDocumentSchemaType, ObjectField, Path, SchemaType} from 'sanity'
8
2
 
9
3
  type ObjectFieldWithPath = ObjectField<SchemaType> & {path: Path}
10
4
 
@@ -42,11 +36,15 @@ function extractInnerFields(
42
36
  )
43
37
 
44
38
  return [...acc, thisFieldWithPath, ...innerFields]
45
- } else if (field.type.jsonType === 'array' && isArraySchemaType(field)) {
39
+ } else if (
40
+ field.type.jsonType === 'array' &&
41
+ field.type.of.length &&
42
+ field.type.of.some((item) => 'fields' in item)
43
+ ) {
46
44
  const innerFields = extractInnerFields(
47
45
  // TODO: Fix TS assertion for array fields
48
46
  // @ts-expect-error
49
- field.type.of,
47
+ field.type.of[0].fields,
50
48
  [...path, field.name],
51
49
  maxDepth
52
50
  )