dialog
dialog copied to clipboard
fix: destroyOnClose fails with forceRender
ant-design/ant-design#28847
解决destroyOnClose
和forceRender
都设置为true
时destroyOnClose
失效
原因:当forceRender
设置为true
时,判断是否删除子节点的语句失效
方案:为forceRender
增加一层缓存,当第一次打开Modal
时设置forceRender
为false
此外,感觉antd文档里关于forceRender
部分的描述不是很清晰,个人理解为首次未打开Modal
可获取其中的dom
觉得可以和dialog
的文档稍作同步
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/react-component/dialog/ookx04a0g
✅ Preview: https://dialog-git-fork-helloany-fix-destroyonclose.react-component.vercel.app
Codecov Report
Merging #232 (8f7c630) into master (586bfcb) will increase coverage by
0.06%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #232 +/- ##
==========================================
+ Coverage 98.10% 98.17% +0.06%
==========================================
Files 6 6
Lines 158 164 +6
Branches 46 47 +1
==========================================
+ Hits 155 161 +6
Misses 2 2
Partials 1 1
Impacted Files | Coverage Δ | |
---|---|---|
src/DialogWrap.tsx | 95.45% <100.00%> (+1.33%) |
:arrow_up: |
src/Dialog/Content/index.tsx | 95.23% <0.00%> (-0.12%) |
:arrow_down: |
src/Dialog/index.tsx | 100.00% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 586bfcb...8f7c630. Read the comment docs.
3.x 也有这个问题。😳
冲突了
ping @HelloAny