|
@@ -6,13 +6,15 @@ import React, {
|
|
|
useCallback,
|
|
|
useState,
|
|
|
useImperativeHandle,
|
|
|
- useId
|
|
|
+ useId,
|
|
|
+ useTransition
|
|
|
} from 'react'
|
|
|
import { Modal, Form } from 'antd'
|
|
|
import type { ModalProps } from 'antd'
|
|
|
|
|
|
const MyModal = memo(
|
|
|
forwardRef((prop: any, ref) => {
|
|
|
+ const [, startTransition] = useTransition()
|
|
|
const [form] = Form.useForm()
|
|
|
const [modalChildren, setModalChildren] = useState<React.ReactElement>(null)
|
|
|
const [loading, setLoading] = useState(false)
|
|
@@ -49,9 +51,14 @@ const MyModal = memo(
|
|
|
...source,
|
|
|
visible: false
|
|
|
}))
|
|
|
+ startTransition(() => {
|
|
|
+ if (typeRef.current === 'form') {
|
|
|
+ form.resetFields()
|
|
|
+ }
|
|
|
+ })
|
|
|
}, [form])
|
|
|
|
|
|
- // 关闭当前Modal
|
|
|
+ // 打开当前Modal
|
|
|
const onOpen = useCallback(() => {
|
|
|
setModalProps(source => ({
|
|
|
...source,
|