Skip to content

fix: fix FormItem hooks render error #22053

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

Merged
merged 1 commit into from
Mar 10, 2020
Merged

fix: fix FormItem hooks render error #22053

merged 1 commit into from
Mar 10, 2020

Conversation

kagawagao
Copy link
Contributor

@kagawagao kagawagao commented Mar 10, 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

💡 Background and solution

set name property for FormItem which has no name been set before will cause React hooks render error
image

if (!hasName && !isRenderProps && !dependencies) {
return renderLayout(children);
}
// Record for real component render
const updateRef = React.useRef(0);
updateRef.current += 1;

Edit antd reproduction template

declare updateRef hook in advance can fix this bug

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ 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

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Mar 10, 2020

@codecov
Copy link

codecov bot commented Mar 10, 2020

Codecov Report

Merging #22053 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22053   +/-   ##
=======================================
  Coverage   97.96%   97.96%           
=======================================
  Files         306      306           
  Lines        7039     7039           
  Branches     1937     1938    +1     
=======================================
  Hits         6896     6896           
  Misses        143      143
Impacted Files Coverage Δ
components/form/FormItem.tsx 99.13% <100%> (ø) ⬆️

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 122b218...aa3aee3. Read the comment docs.

@codesandbox-ci
Copy link

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 582e57bc5bcb6780701a20e625f5b43b073a331b:

Sandbox Source
antd reproduction template Configuration
antd reproduction template PR

@codesandbox-ci
Copy link

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 aa3aee3:

Sandbox Source
antd reproduction template Configuration
antd reproduction template PR

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