@sanity/assist 1.2.7 → 1.2.8

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
@@ -179,7 +179,7 @@ function isUnsupportedType(type) {
179
179
  }
180
180
  const inlineTypes = ["document", "object", "image", "file"];
181
181
  function serializeSchema(schema, options) {
182
- const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
182
+ const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => isAssistSupported(t)).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
183
183
  if ("to" in t && t.to && !t.to.length) {
184
184
  return false;
185
185
  }
@@ -4435,7 +4435,7 @@ const assistFieldActions = {
4435
4435
  isDocAssistable: documentIsAssistable != null ? documentIsAssistable : false
4436
4436
  });
4437
4437
  const isSelectable = !!useSelectedField(documentSchemaType, typePath);
4438
- const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable;
4438
+ const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable && isSchemaAssistEnabled(documentSchemaType);
4439
4439
  const fieldAssist = react.useMemo(() => {
4440
4440
  var _a;
4441
4441
  return ((_a = assistDocument == null ? void 0 : assistDocument.fields) != null ? _a : []).find(f => f.path === typePath || pathKey === documentRootKey && f.path === pathKey);
@@ -4727,7 +4727,10 @@ const assist = sanity.definePlugin(config => {
4727
4727
  schemaType
4728
4728
  } = _ref17;
4729
4729
  const docSchema = schema.get(schemaType);
4730
- return [...prev, createAssistDocumentPresence(documentId, docSchema)];
4730
+ if (isSchemaAssistEnabled(docSchema)) {
4731
+ return [...prev, createAssistDocumentPresence(documentId, docSchema)];
4732
+ }
4733
+ return prev;
4731
4734
  }
4732
4735
  },
4733
4736
  studio: {