Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Form.List nest warning #22575

Merged
merged 1 commit into from Mar 24, 2020
Merged

fix: Form.List nest warning #22575

merged 1 commit into from Mar 24, 2020

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Mar 24, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

resolve #22544

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix nest dynamic Form.Item get react unmounted update warning.
🇨🇳 Chinese 修复嵌套动态 Form.Item 会被 react 警告更新移除节点的信息。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@tests-checker tests-checker bot left a comment

Could you please add tests to make sure this change works as expected?

@ant-design-bot
Copy link
Contributor

@ant-design-bot ant-design-bot commented Mar 24, 2020

@zombieJ zombieJ merged commit 8514e0f into master Mar 24, 2020
27 of 29 checks passed
@zombieJ zombieJ deleted the form-warning branch Mar 24, 2020
@codesandbox-ci
Copy link

@codesandbox-ci codesandbox-ci bot commented Mar 24, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cf337ee:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

@codecov codecov bot commented Mar 24, 2020

Codecov Report

Merging #22575 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22575      +/-   ##
==========================================
- Coverage   98.16%   98.12%   -0.05%     
==========================================
  Files         306      306              
  Lines        7072     7076       +4     
  Branches     1945     1900      -45     
==========================================
+ Hits         6942     6943       +1     
- Misses        130      133       +3
Impacted Files Coverage Δ
components/form/FormItem.tsx 99.11% <ø> (ø) ⬆️
components/form/util.ts 100% <100%> (ø) ⬆️
components/carousel/index.tsx 93.33% <0%> (-6.67%) ⬇️

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 d0e182e...cf337ee. Read the comment docs.


React.useEffect(
() => () => {
destroyRef.current = true;
Copy link
Member

@afc163 afc163 Mar 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个感觉只是 workaround,副作用没有卸载干净才是原因?

Copy link
Member Author

@zombieJ zombieJ Mar 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noStyle 里在 useEffect 的 clean up 里会额外调用一次来清除 Field 的信息,但是如果是整个 Form 都移除了,那这次 cleanup 的 update 就作用到 unmounted FormItem 上了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants