-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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: React DOM crashes when <option> contains three interpolated valu… #12078
Conversation
…e if one is a conditional. facebook#11911
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
@@ -46,7 +46,7 @@ describe('ReactDOMOption', () => { | |||
' in div (at **)\n' + | |||
' in option (at **)', | |||
); | |||
expect(node.innerHTML).toBe('1 2'); | |||
expect(node.innerHTML).toBe('1 <div></div> 2'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behavior change. I don't think we want this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please:
-
Don't change the existing behavior (apart from from fixing a bug). It should match how this worked in React 15.
-
Add a test that would have failed without your fix.
Sorry that is my fault! I will fix it in today. |
reduce option child
@gaearon please review again |
@gaearon Would you have anytime to review, please? |
Can you explain what this is doing? It’s not obvious from the code that it is correct. Generally when submitting a PR it is a good idea to explain how you arrived at this conclusion, when it got broken, whether you can point to React 15 code doing a similar thing, etc. |
My english is not good enough to explain how I do this. When render If render like this, when change the value, option has one child that is textNode. So react was crash and warning Node was not found. I find out function
I think you're right, I should do something like React 15 code. |
My point is:
|
I only looked at this briefly, but I think there may be a deeper issue with child reconciliation. Specifically this logic (or maybe somewhere else upstream) in react/packages/react-reconciler/src/ReactFiberCommitWork.js Lines 630 to 648 in 3596e40
|
This was fixed in #13261. Thanks! |
fix #11911
…e if one is a conditional. #11911
Before submitting a pull request, please make sure the following is done:
master
.yarn
in the repository root.yarn test
). Tip:yarn test --watch TestName
is helpful in development.yarn test-prod
to test in the production environment. It supports the same options asyarn test
.yarn debug-test --watch TestName
, openchrome://inspect
, and press "Inspect".yarn prettier
).yarn lint
). Tip:yarn linc
to only check changed files.yarn flow
).Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html