diff --git a/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/List/ListArrayInput.tsx b/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/List/ListArrayInput.tsx index c1def187c73..204ab3f8b7b 100644 --- a/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/List/ListArrayInput.tsx +++ b/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/List/ListArrayInput.tsx @@ -66,6 +66,7 @@ export function ListArrayInput(props: ArrayOfObjectsInp ) : ( [ - restrictToParentElementWithMargins({y: 4}), - ...(lockAxis ? [restrictToAxis(lockAxis)] : []), - ], - [lockAxis] + () => [restrictToParentElementWithMargins({y: 4}), ...(axis ? [restrictToAxis(axis)] : [])], + [axis] ) return ( @@ -81,7 +89,7 @@ function SortableList(props: ListProps) { collisionDetection={closestCenter} onDragEnd={handleDragEnd} > - + {children} @@ -120,7 +128,7 @@ function SortableListItem(props: ItemProps) { interface ListProps extends ComponentProps { sortable?: boolean - lockAxis?: 'x' | 'y' + axis?: Axis items: string[] onItemMove?: (event: {fromIndex: number; toIndex: number}) => void children?: React.ReactNode