@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.esm.js CHANGED
@@ -3574,9 +3574,13 @@ function FieldRefPathInput(props) {
3574
3574
  if (!field.key.includes("|") || !typePath) {
3575
3575
  return true;
3576
3576
  }
3577
- const dotSplit = typePath.split(".");
3578
- const base = dotSplit.slice(0, dotSplit.length - 1).join(".");
3579
- return field.key.includes(base);
3577
+ if (field.key.includes("|") && !typePath.includes("|")) {
3578
+ return false;
3579
+ }
3580
+ const fieldSegments = field.key.split(".");
3581
+ const lastArrayItemIndex = fieldSegments.findLastIndex(s => s.includes("|"));
3582
+ const mustStartWith = fieldSegments.slice(0, lastArrayItemIndex + 1).join(".");
3583
+ return typePath.startsWith(mustStartWith);
3580
3584
  }, [typePath]);
3581
3585
  if (!documentSchema) {
3582
3586
  return props.renderDefault(props);
@@ -4714,7 +4718,7 @@ const assist = definePlugin(config => {
4714
4718
  schemaType
4715
4719
  } = _ref17;
4716
4720
  const docSchema = schema.get(schemaType);
4717
- if (isSchemaAssistEnabled(docSchema)) {
4721
+ if (docSchema && isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
4718
4722
  return [...prev, createAssistDocumentPresence(documentId, docSchema)];
4719
4723
  }
4720
4724
  return prev;