@sanity/assist 1.2.9 → 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);