diff --git a/packages/sanity/src/core/form/store/useFormState.ts b/packages/sanity/src/core/form/store/useFormState.ts index 591bab50dbba..3d1651fc6bfa 100644 --- a/packages/sanity/src/core/form/store/useFormState.ts +++ b/packages/sanity/src/core/form/store/useFormState.ts @@ -57,40 +57,40 @@ export function useFormState< const [prepareReadOnlyState] = useState(() => createCallbackResolver({property: 'readOnly'})) const [prepareFormState] = useState(() => createPrepareFormState()) - const reconcileFieldGroupState = useMemo(() => { + const [reconcileFieldGroupState] = useState(() => { let last: StateTree | undefined return (state: StateTree | undefined) => { const result = immutableReconcile(last ?? null, state) last = result return result } - }, []) + }) const reconciledFieldGroupState = useMemo(() => { return reconcileFieldGroupState(fieldGroupState) }, [fieldGroupState, reconcileFieldGroupState]) - const reconcileCollapsedPaths = useMemo(() => { + const [reconcileCollapsedPaths] = useState(() => { let last: StateTree | undefined return (state: StateTree | undefined) => { const result = immutableReconcile(last ?? null, state) last = result return result } - }, []) + }) const reconciledCollapsedPaths = useMemo( () => reconcileCollapsedPaths(collapsedPaths), [collapsedPaths, reconcileCollapsedPaths], ) - const reconcileCollapsedFieldsets = useMemo(() => { + const [reconcileCollapsedFieldsets] = useState(() => { let last: StateTree | undefined return (state: StateTree | undefined) => { const result = immutableReconcile(last ?? null, state) last = result return result } - }, []) + }) const reconciledCollapsedFieldsets = useMemo( () => reconcileCollapsedFieldsets(collapsedFieldSets), [collapsedFieldSets, reconcileCollapsedFieldsets],