Skip to content

Commit

Permalink
fix: 数组容器点击删除未删除错误内容
Browse files Browse the repository at this point in the history
  • Loading branch information
mengshang918 committed Jan 14, 2022
1 parent 714ac6d commit ce11e27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 1 addition & 8 deletions packages/drip-form/src/container/ArrayContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: jiangxiaowei
* @Date: 2021-08-11 15:25:43
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2022-01-07 16:54:47
* @Last Modified time: 2022-01-14 14:57:53
*/
import React, { useMemo, useState, useEffect, memo, CSSProperties } from 'react'
import cx from 'classnames'
Expand Down Expand Up @@ -170,13 +170,6 @@ const ArrayContainer: FC<Props & RenderFnProps & ArrayProps> = ({
])

const addIcon = useMemo(() => <FontAwesomeIcon icon={faPlus} />, [])
// const deltIcon = useCallback(
// (i) =>
// isAdd && (
// <FontAwesomeIcon icon={faTrashAlt} onClick={deltItem.bind(this, i)} />
// ),
// [deltItem, isAdd]
// )

return (
<div
Expand Down
7 changes: 6 additions & 1 deletion packages/hooks/src/useArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: jiangxiaowei
* @Date: 2021-08-01 16:54:41
* @Last Modified by: jiangxiaowei
* @Last Modified time: 2021-12-24 15:21:53
* @Last Modified time: 2022-01-14 16:03:21
*/
import { useCallback } from 'react'
import produce from 'immer'
Expand Down Expand Up @@ -54,6 +54,11 @@ const useArray = ({
isDelete: true,
},
})
// ajv实时校验会重新生成错误信息,如果用户setErr添加了ignore,则ajv会跳过,所以这里需要手动删除
dispatch({
type: 'deleteError',
key: `${fieldKey}.${order}`,
})
dispatch({
type: 'deleteFormData',
key: `${fieldKey}.${order}`,
Expand Down

0 comments on commit ce11e27

Please sign in to comment.