Skip to content

Commit b3bb398

Browse files
committed
prep warnings
1 parent d901e39 commit b3bb398

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

packages/shared/lowPriorityWarning.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
1818
let lowPriorityWarning = lowPriorityWarningWithoutStack;
1919

2020
if (__DEV__) {
21-
lowPriorityWarning = function(condition, format, ...args) {
22-
if (condition) {
23-
return;
24-
}
21+
lowPriorityWarning = function(format, ...args) {
2522
const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2623
const stack = ReactDebugCurrentFrame.getStackAddendum();
27-
// eslint-disable-next-line react-internal/warning-and-invariant-args
24+
// eslint-disable-next-line react-internal/warning-args
2825
lowPriorityWarningWithoutStack(false, format + '%s', ...args, stack);
2926
};
3027
}

packages/shared/lowPriorityWarningWithoutStack.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,15 @@ if (__DEV__) {
3636
} catch (x) {}
3737
};
3838

39-
lowPriorityWarningWithoutStack = function(condition, format, ...args) {
39+
lowPriorityWarningWithoutStack = function(format, ...args) {
4040
if (format === undefined) {
4141
throw new Error(
4242
'`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' +
4343
'message argument',
4444
);
4545
}
46-
if (!condition) {
47-
printWarning(format, ...args);
48-
}
46+
47+
printWarning(format, ...args);
4948
};
5049
}
5150

packages/shared/warning.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
1818
let warning = warningWithoutStack;
1919

2020
if (__DEV__) {
21-
warning = function(condition, format, ...args) {
22-
if (condition) {
23-
return;
24-
}
21+
warning = function(format, ...args) {
2522
const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2623
const stack = ReactDebugCurrentFrame.getStackAddendum();
27-
// eslint-disable-next-line react-internal/warning-and-invariant-args
24+
// eslint-disable-next-line react-internal/warning-args
2825
warningWithoutStack(false, format + '%s', ...args, stack);
2926
};
3027
}

packages/shared/warningWithoutStack.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
/**
9-
* Similar to invariant but only logs a warning if the condition is not met.
109
* This can be used to log issues in development environments in critical
1110
* paths. Removing the logging code for production environments will keep the
1211
* same logic and follow the same code paths.
@@ -15,7 +14,7 @@
1514
let warningWithoutStack = () => {};
1615

1716
if (__DEV__) {
18-
warningWithoutStack = function(condition, format, ...args) {
17+
warningWithoutStack = function(format, ...args) {
1918
if (format === undefined) {
2019
throw new Error(
2120
'`warningWithoutStack(condition, format, ...args)` requires a warning ' +
@@ -28,9 +27,6 @@ if (__DEV__) {
2827
'warningWithoutStack() currently supports at most 8 arguments.',
2928
);
3029
}
31-
if (condition) {
32-
return;
33-
}
3430
if (typeof console !== 'undefined') {
3531
const argsWithFormat = args.map(item => '' + item);
3632
argsWithFormat.unshift('Warning: ' + format);

0 commit comments

Comments
 (0)