UNPKG

@yuntijs/ui

Version:

☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps

19 lines 731 B
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; import { Form } from 'antd'; import { memo, useEffect, useState } from 'react'; export var FormCollapseListFieldsWatcher = /*#__PURE__*/memo(function (_ref) { var name = _ref.name, update = _ref.update; var rows = Form.useWatch(name); var _useState = useState(0), _useState2 = _slicedToArray(_useState, 2), preRowsCount = _useState2[0], setPreRowsCount = _useState2[1]; useEffect(function () { if ((rows === null || rows === void 0 ? void 0 : rows.length) !== preRowsCount) { update(); setPreRowsCount(rows === null || rows === void 0 ? void 0 : rows.length); } }, [preRowsCount, rows, update]); return null; });