@sanity/assist 1.2.8 → 1.2.10
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/dist/index.js
CHANGED
|
@@ -3587,9 +3587,13 @@ function FieldRefPathInput(props) {
|
|
|
3587
3587
|
if (!field.key.includes("|") || !typePath) {
|
|
3588
3588
|
return true;
|
|
3589
3589
|
}
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3590
|
+
if (field.key.includes("|") && !typePath.includes("|")) {
|
|
3591
|
+
return false;
|
|
3592
|
+
}
|
|
3593
|
+
const fieldSegments = field.key.split(".");
|
|
3594
|
+
const lastArrayItemIndex = fieldSegments.findLastIndex(s => s.includes("|"));
|
|
3595
|
+
const mustStartWith = fieldSegments.slice(0, lastArrayItemIndex + 1).join(".");
|
|
3596
|
+
return typePath.startsWith(mustStartWith);
|
|
3593
3597
|
}, [typePath]);
|
|
3594
3598
|
if (!documentSchema) {
|
|
3595
3599
|
return props.renderDefault(props);
|
|
@@ -4727,7 +4731,7 @@ const assist = sanity.definePlugin(config => {
|
|
|
4727
4731
|
schemaType
|
|
4728
4732
|
} = _ref17;
|
|
4729
4733
|
const docSchema = schema.get(schemaType);
|
|
4730
|
-
if (isSchemaAssistEnabled(docSchema)) {
|
|
4734
|
+
if (docSchema && sanity.isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
|
|
4731
4735
|
return [...prev, createAssistDocumentPresence(documentId, docSchema)];
|
|
4732
4736
|
}
|
|
4733
4737
|
return prev;
|