@sanity/assist 4.4.2 → 4.4.3

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
@@ -3208,9 +3208,17 @@ function AssistDocumentFormEditable(props) {
3208
3208
  }),
3209
3209
  [formCallbacks, onPathOpen, params, setParams, instruction2]
3210
3210
  );
3211
- return react.useEffect(() => {
3211
+ react.useEffect(() => {
3212
3212
  activePath && !instruction2 && onPathOpen([]);
3213
- }, [activePath, instruction2, onPathOpen]), /* @__PURE__ */ jsxRuntime.jsx(SelectedFieldContextProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 5, children: [
3213
+ }, [activePath, instruction2, onPathOpen]);
3214
+ const fieldError = react.useMemo(() => {
3215
+ const fieldError2 = props.members.find(
3216
+ (m) => m.kind === "error" && m.fieldName === "fields"
3217
+ );
3218
+ if (fieldError2)
3219
+ return /* @__PURE__ */ jsxRuntime.jsx(sanity.MemberFieldError, { member: fieldError2 });
3220
+ }, [props.members]);
3221
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectedFieldContextProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 5, children: [
3214
3222
  /* @__PURE__ */ jsxRuntime.jsx(
3215
3223
  FieldsInitializer,
3216
3224
  {
@@ -3223,7 +3231,8 @@ function AssistDocumentFormEditable(props) {
3223
3231
  typePath
3224
3232
  ),
3225
3233
  instruction2 && /* @__PURE__ */ jsxRuntime.jsx(BackToInstructionListLink, {}),
3226
- activePath && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormCallbacksProvider, { ...newCallbacks, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { lineHeight: "1.25em" }, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.FormInput, { ...props, absolutePath: activePath }) }) }),
3234
+ activePath && !fieldError && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormCallbacksProvider, { ...newCallbacks, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { lineHeight: "1.25em" }, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.FormInput, { ...props, absolutePath: activePath }) }) }),
3235
+ fieldError,
3227
3236
  !activePath && props.renderDefault(props)
3228
3237
  ] }) });
3229
3238
  }