Skip to content

Commit

Permalink
fix: fixed deleting numbers from arrays (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
NasgulNexus authored May 30, 2023
1 parent 9c7aaa9 commit 76fba69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/core/components/Form/hooks/useField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const useField = <Value extends FieldValue, SpecType extends Spec>({
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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/lib/kit/components/Views/ArrayBaseView.tsx
Original file line number Diff line number Diff line change
@@ -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 = []}) => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 76fba69

Please sign in to comment.