@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.js CHANGED
@@ -3587,9 +3587,13 @@ function FieldRefPathInput(props) {
3587
3587
  if (!field.key.includes("|") || !typePath) {
3588
3588
  return true;
3589
3589
  }
3590
- const dotSplit = typePath.split(".");
3591
- const base = dotSplit.slice(0, dotSplit.length - 1).join(".");
3592
- return field.key.includes(base);
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);