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 React constant element bugs #4940

Merged
merged 2 commits into from
Dec 16, 2016
Merged

Conversation

appden
Copy link
Contributor

@appden appden commented Dec 4, 2016

Q A
Bug fix? yes
Breaking change? no
New feature? no
Deprecations? no
Spec compliancy? no
Tests added/pass? yes
Fixed tickets Fixes #4419, Fixes #4804
License MIT
Doc PR no
Dependency Changes no

There were a couple known issues where transform-react-constant-elements was hoisting the constant element too far. This addresses those and adds regression tests.

Excerpts from the commit messages are below:

  • When block scoped variables caused the block to be wrapped in a closure, the variable bindings remained in parent function scope, which caused the JSX element to be hoisted out of the closure.
  • When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.

When block scoped variables caused the block to be wrapped in a closure, the variable `bindings` remained in parent function scope, which caused the JSX element to be hoisted out of the closure.
When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
@codecov-io
Copy link

codecov-io commented Dec 4, 2016

Current coverage is 89.24% (diff: 100%)

No coverage report found for master at b81cf12.

Powered by Codecov. Last update b81cf12...c438209

@hzoo hzoo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories and removed i: bug labels Dec 15, 2016
@hzoo hzoo added this to the Next Patch milestone Dec 15, 2016
@hzoo
Copy link
Member

hzoo commented Dec 16, 2016

So sorry for the delay, this is great @appden (and a good first PR)! Looking forward to more of you contributions 😄 Let me know if you need help with anything + join our slack.babeljs.io if you haven't!

@hzoo hzoo merged commit 670ee99 into babel:master Dec 16, 2016
@appden appden deleted the fix-react-constant-elements branch December 22, 2016 17:54
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: react outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
4 participants