-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
#6871 - Add not dev warning for ReactPerf & remove dev checking for ReactDebugTool method #6884
#6871 - Add not dev warning for ReactPerf & remove dev checking for ReactDebugTool method #6884
Conversation
…gTool.GetFlushHistory
Hmm, found some problem. I tryed to avoid copy pasting the same code at the beginnig of every method in
but now helper will be executed and independently of it's result, other part of method will be executed too. Need help for good solution here. |
|
||
function roundFloat(val, base = 2) { | ||
var n = Math.pow(10, base); | ||
return Math.floor(val * n) / n; | ||
} | ||
|
||
function returnWarnIfDevFalse(returningValue = 0) { |
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.
Let’s call it warnInProduction
.
@sashashakun updated the pull request. |
Also, should I squash commits before PR will be merged or github do it in right way? |
I’ll squash when this is ready, GitHub now lets it be done via UI. |
@@ -19,11 +19,28 @@ function roundFloat(val, base = 2) { | |||
return Math.floor(val * n) / n; | |||
} | |||
|
|||
function warnInProduction() { | |||
if (typeof console !== 'undefined') { | |||
console.error('ReactPerf is not supported in the production builds of React.' + |
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.
Nitpick: let’s start string literal from the next line.
console.error(
'ga ga ' +
'o la la'
);
@sashashakun updated the pull request. |
@sashashakun updated the pull request. |
@sashashakun updated the pull request. |
@sashashakun updated the pull request. |
Also, have some problem with test in travis, but don't have problems with local tests. P.S. I am afraid that do this PR too long |
Try to merge master into your branch and check if something fails locally.
I’ve been doing the ReactPerf PR for two months so it’s not long. 😉 |
Hmm, merge |
@sashashakun updated the pull request. |
@sashashakun updated the pull request. |
spyOn(console, 'error'); | ||
|
||
expect(ReactPerf.getLastMeasurements()).toEqual([]); | ||
|
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.
Let’s remove the blank lines here, they don’t help much.
@sashashakun updated the pull request. |
A little recap in case it’s confusing what happened here:
Sorry about this mess. 😓 @sashashakun Thanks for this! Sorry it took so long to review. |
@gaearon no problem, I understand 😌 thanks for help!👍 |
) Fixes facebook#6871 (cherry picked from commit 2a46103)
Via #6871
Steps before PR:
master
.grunt test
).grunt lint
) - we've done our best to make sure these rules match our internal linting guidelines.