From 32a69b32a3d1b8ddedf7af5e1d26361ba4194ce1 Mon Sep 17 00:00:00 2001 From: NasgulNexus Date: Mon, 29 May 2023 17:53:07 +0200 Subject: [PATCH 1/3] fix: fixed deleting numbers from arrays --- src/lib/core/components/Form/hooks/useField.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/core/components/Form/hooks/useField.tsx b/src/lib/core/components/Form/hooks/useField.tsx index 28d25d93..60ed82d8 100644 --- a/src/lib/core/components/Form/hooks/useField.tsx +++ b/src/lib/core/components/Form/hooks/useField.tsx @@ -101,7 +101,7 @@ export const useField = ({ const error = validate?.(_value); let value = transformArrIn(_value); - if (isNumberSpec(spec) && value && !error) { + if (isNumberSpec(spec) && value && value !== REMOVED_ITEM && !error) { value = Number(value) as Value; } @@ -200,6 +200,7 @@ export const useField = ({ [`<${idx}>`]: REMOVED_ITEM, } as Value; const error = validate?.(value); + console.log(idx); setState((state) => ({ ...state, From 069fa546138b24b4dca743728985266de55f29ba Mon Sep 17 00:00:00 2001 From: NasgulNexus Date: Mon, 29 May 2023 17:55:08 +0200 Subject: [PATCH 2/3] fix: removed extra console log --- src/lib/core/components/Form/hooks/useField.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/core/components/Form/hooks/useField.tsx b/src/lib/core/components/Form/hooks/useField.tsx index 60ed82d8..0984a1e5 100644 --- a/src/lib/core/components/Form/hooks/useField.tsx +++ b/src/lib/core/components/Form/hooks/useField.tsx @@ -200,7 +200,6 @@ export const useField = ({ [`<${idx}>`]: REMOVED_ITEM, } as Value; const error = validate?.(value); - console.log(idx); setState((state) => ({ ...state, From c9caeb1fe7d32865f8c772829c5719085f73217e Mon Sep 17 00:00:00 2001 From: NasgulNexus Date: Mon, 29 May 2023 19:41:24 +0200 Subject: [PATCH 3/3] fix: fixed editor crash --- src/lib/kit/components/Views/ArrayBaseView.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/kit/components/Views/ArrayBaseView.tsx b/src/lib/kit/components/Views/ArrayBaseView.tsx index ec3ced31..9353463a 100644 --- a/src/lib/kit/components/Views/ArrayBaseView.tsx +++ b/src/lib/kit/components/Views/ArrayBaseView.tsx @@ -1,5 +1,7 @@ import React from 'react'; +import _ from 'lodash'; + import {ArrayView, Spec, ViewController, isCorrectSpec} from '../../../core'; export const ArrayBaseView: ArrayView = ({spec, name, value = []}) => { @@ -27,7 +29,7 @@ export const ArrayBaseView: ArrayView = ({spec, name, value = []}) => { const items = React.useMemo( () => - value.map((__, idx) => { + _.map(value, (__, idx) => { const itemSpec = getItemSpec(idx); if (!itemSpec) {