-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevTools: Don't load source files contaning only unnamed hooks
This wastes CPU cycles.
- Loading branch information
Brian Vaughn
committed
Jul 8, 2021
1 parent
f52b73f
commit 2cdb5e2
Showing
5 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...s-extensions/src/__tests__/__source__/__untransformed__/ComponentWithExternalUseEffect.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
const {useState} = require('react'); | ||
const {useCustom} = require('./useCustom'); | ||
|
||
function Component(props) { | ||
const [count] = useState(0); | ||
useCustom(); | ||
return count; | ||
} | ||
|
||
module.exports = {Component}; |
18 changes: 18 additions & 0 deletions
18
packages/react-devtools-extensions/src/__tests__/__source__/__untransformed__/useCustom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
const {useEffect} = require('react'); | ||
|
||
function useCustom() { | ||
useEffect(() => { | ||
// ... | ||
}, []); | ||
} | ||
|
||
module.exports = {useCustom}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters