ant-design / ant-design/pro-components
🐛[BUG]ProForm 和ModalForm 的request 和Form的hooks一起使用request和initialValue的值赋值永远是上一次的值
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
### 🐛 bug 描述
ProForm 和ModalForm 的request 和Form的hooks一起使用request和initialValue的值赋值永远是上一次的值,我自己用ProForm和modal封装也会出现,不知道是Form.useWatch的问题还是request的问题
### 📷 复现步骤
点击弹窗,在保存数据,在点击弹窗是上一次的值,而且request的值是对的,form.useWatch的values值会覆盖request的值
### 🏞 期望结果
希望弹窗永远是最新的值
### 💻 复现代码
[可以看代码复现](https://codesandbox.io/p/sandbox/promodalform-6y9prg?file=%2Fsrc%2FModalTest.jsx%3A33%2C11&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clzgasuka00063b6ltkwbg6v0%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clzgasuka00023b6lkk63ut3u%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clzgasuka00033b6luz1k3tp7%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clzgasuka00053b6lkwqikqwi%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clzgasuka00023b6lkk63ut3u%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzgasuka00013b6lejkzrzj3%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clzgc6j8u00023b6lo58cxfw8%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A33%252C%2522startColumn%2522%253A11%252C%2522endLineNumber%2522%253A33%252C%2522endColumn%2522%253A11%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FModalTest.jsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clzgasuka00023b6lkk63ut3u%2522%252C%2522activeTabId%2522%253A%2522clzgc6j8u00023b6lo58cxfw8%2522%257D%252C%2522clzgasuka00053b6lkwqikqwi%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzgasuka00043b6lqrcs2f8t%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clzgasuka00053b6lkwqikqwi%2522%252C%2522activeTabId%2522%253A%2522clzgasuka00043b6lqrcs2f8t%2522%257D%252C%2522clzgasuka00033b6luz1k3tp7%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clzgasuka00033b6luz1k3tp7%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)
### © 版本信息
- ProForm 版本: [e.g. 2.28.4]
- umi 版本
- 浏览器环境 google最新
- 开发环境 [e.g. mac OS]
### 🚑 其他信息
https://github.com/user-attachments/assets/a087b6fe-6e97-4cbe-8460-805c356f2056
Contributor guide
Research direction
Start with the linked CodeSandbox, especially /src/ModalTest.jsx at line 33, and reproduce the sequence of opening the modal, saving data, and reopening it. Trace how ProForm and ModalForm combine request, initialValue, and Form.useWatch values. Done means reopening the modal consistently displays the latest values rather than the previous ones.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100