diff --git a/packages/dm-core-plugins/src/form/components/PrimitiveArray.tsx b/packages/dm-core-plugins/src/form/components/PrimitiveArray.tsx index 198fc9997..b25cedd5a 100644 --- a/packages/dm-core-plugins/src/form/components/PrimitiveArray.tsx +++ b/packages/dm-core-plugins/src/form/components/PrimitiveArray.tsx @@ -36,10 +36,10 @@ const PrimitiveArray = ({ onChange, }: PrimitiveArrayProps) => { const [hovering, setHovering] = useState(-1) - const methods = useFormContext() + const { getValues } = useFormContext() const updateValues = (index: number, newValue: TPrimitive): void => { - const newValues = [...methods.getValues(namePath)] + const newValues = [...getValues(namePath)] switch (attribute.attributeType) { case 'boolean': newValues[index] = newValue @@ -55,7 +55,7 @@ const PrimitiveArray = ({ } } const removeItem = (index: number) => { - const newValues = [...methods.getValues(namePath)] + const newValues = [...getValues(namePath)] newValues.splice(index, 1) onChange(newValues) }