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

[Fresh] Use function expression for custom Hook signature argument #15956

Merged
merged 1 commit into from
Jun 22, 2019

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 22, 2019

Needed internally, see D15947985.
We can later change that back but for now I'd like to not have to worry about this.

@sizebot
Copy link

sizebot commented Jun 22, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS

@gaearon gaearon merged commit d271df5 into facebook:master Jun 22, 2019
gaearon added a commit to gaearon/react that referenced this pull request Jun 24, 2019
rickhanlonii pushed a commit to rickhanlonii/react that referenced this pull request Jun 25, 2019
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Oct 31, 2023
Summary:
Hermes supports arrows. I assume the only reason the transform wasn't dropped is due to the scary TODO.

Originally, the arrow transform was conditional like this:

```js
  if (isNull || src.indexOf('=>') !== -1) {
    extraPlugins.push(es2015ArrowFunctions);
  }
```

I made it unconditional in facebook/metro@beb3d1a (D15947985) to work around an issue where React Refresh Babel plugin emitted arrow functions. However, I fixed that plugin to _not_ emit arrow functions a long time ago in facebook/react#15956. So this TODO is effectively solved, and has been, for ages.

In this commit, we:

- Skip the transform for Hermes altogether
- For non-Hermes, revert to the old conditional behavior

Possible alternatives:

- We could skip it for Hermes but apply unconditionally otherwise (a bit simpler)
- Or, if all target non-Hermes runtimes already support it natively, we could completely remove it

## Changelog:

[GENERAL] [CHANGED] - Apply Babel arrow transform only on non-Hermes

Pull Request resolved: #41253

Test Plan: Run fbsource tests (that's for you, not for me :)

Reviewed By: NickGerleman

Differential Revision: D50818568

Pulled By: robhogan

fbshipit-source-id: ad96540bb7778792d38a6ddec06999d2acf620d0
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
Summary:
Hermes supports arrows. I assume the only reason the transform wasn't dropped is due to the scary TODO.

Originally, the arrow transform was conditional like this:

```js
  if (isNull || src.indexOf('=>') !== -1) {
    extraPlugins.push(es2015ArrowFunctions);
  }
```

I made it unconditional in facebook/metro@beb3d1a (D15947985) to work around an issue where React Refresh Babel plugin emitted arrow functions. However, I fixed that plugin to _not_ emit arrow functions a long time ago in facebook/react#15956. So this TODO is effectively solved, and has been, for ages.

In this commit, we:

- Skip the transform for Hermes altogether
- For non-Hermes, revert to the old conditional behavior

Possible alternatives:

- We could skip it for Hermes but apply unconditionally otherwise (a bit simpler)
- Or, if all target non-Hermes runtimes already support it natively, we could completely remove it

## Changelog:

[GENERAL] [CHANGED] - Apply Babel arrow transform only on non-Hermes

Pull Request resolved: facebook#41253

Test Plan: Run fbsource tests (that's for you, not for me :)

Reviewed By: NickGerleman

Differential Revision: D50818568

Pulled By: robhogan

fbshipit-source-id: ad96540bb7778792d38a6ddec06999d2acf620d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants