Skip to content

Commit e3b59c1

Browse files
committed
comments
1 parent 341faaf commit e3b59c1

File tree

6 files changed

+37
-43
lines changed

6 files changed

+37
-43
lines changed

packages/create-subscription/src/createSubscription.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ export function createSubscription<Property, Value>(
4141
typeof getCurrentValue === 'function',
4242
'Subscription must specify a getCurrentValue function',
4343
);
44-
}
45-
if (__DEV__) {
4644
warningWithoutStack(
4745
typeof subscribe === 'function',
4846
'Subscription must specify a subscribe function',

packages/react-dom/src/client/ReactDOM.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ const ReactDOM: Object = {
142142
// Temporary alias since we already shipped React 16 RC with it.
143143
// TODO: remove in React 17.
144144
unstable_createPortal(...args) {
145-
if (!didWarnAboutUnstableCreatePortal) {
146-
didWarnAboutUnstableCreatePortal = true;
147-
if (__DEV__) {
145+
if (__DEV__) {
146+
if (!didWarnAboutUnstableCreatePortal) {
147+
didWarnAboutUnstableCreatePortal = true;
148148
lowPriorityWarningWithoutStack(
149149
false,
150150
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +

packages/react-dom/src/client/ReactDOMSelect.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,24 @@ const valuePropNames = ['value', 'defaultValue'];
4040
* Validation function for `value` and `defaultValue`.
4141
*/
4242
function checkSelectPropTypes(props) {
43-
ReactControlledValuePropTypes.checkPropTypes('select', props);
43+
if (__DEV__) {
44+
ReactControlledValuePropTypes.checkPropTypes('select', props);
4445

45-
for (let i = 0; i < valuePropNames.length; i++) {
46-
const propName = valuePropNames[i];
47-
if (props[propName] == null) {
48-
continue;
49-
}
50-
const isArray = Array.isArray(props[propName]);
51-
if (props.multiple && !isArray) {
52-
if (__DEV__) {
46+
for (let i = 0; i < valuePropNames.length; i++) {
47+
const propName = valuePropNames[i];
48+
if (props[propName] == null) {
49+
continue;
50+
}
51+
const isArray = Array.isArray(props[propName]);
52+
if (props.multiple && !isArray) {
5353
warning(
5454
false,
5555
'The `%s` prop supplied to <select> must be an array if ' +
5656
'`multiple` is true.%s',
5757
propName,
5858
getDeclarationErrorAddendum(),
5959
);
60-
}
61-
} else if (!props.multiple && isArray) {
62-
if (__DEV__) {
60+
} else if (!props.multiple && isArray) {
6361
warning(
6462
false,
6563
'The `%s` prop supplied to <select> must be a scalar ' +

packages/react-dom/src/server/ReactPartialRendererHooks.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,6 @@ export function useLayoutEffect(
392392
) {
393393
if (__DEV__) {
394394
currentHookNameInDev = 'useLayoutEffect';
395-
}
396-
if (__DEV__) {
397395
warning(
398396
false,
399397
'useLayoutEffect does nothing on the server, because its effect cannot ' +

packages/react-dom/src/shared/CSSPropertyOperations.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,27 +128,27 @@ export function validateShorthandPropertyCollisionInDev(
128128
styleUpdates,
129129
nextStyles,
130130
) {
131-
if (!warnAboutShorthandPropertyCollision) {
132-
return;
133-
}
131+
if (__DEV__) {
132+
if (!warnAboutShorthandPropertyCollision) {
133+
return;
134+
}
134135

135-
if (!nextStyles) {
136-
return;
137-
}
136+
if (!nextStyles) {
137+
return;
138+
}
138139

139-
const expandedUpdates = expandShorthandMap(styleUpdates);
140-
const expandedStyles = expandShorthandMap(nextStyles);
141-
const warnedAbout = {};
142-
for (const key in expandedUpdates) {
143-
const originalKey = expandedUpdates[key];
144-
const correctOriginalKey = expandedStyles[key];
145-
if (correctOriginalKey && originalKey !== correctOriginalKey) {
146-
const warningKey = originalKey + ',' + correctOriginalKey;
147-
if (warnedAbout[warningKey]) {
148-
continue;
149-
}
150-
warnedAbout[warningKey] = true;
151-
if (__DEV__) {
140+
const expandedUpdates = expandShorthandMap(styleUpdates);
141+
const expandedStyles = expandShorthandMap(nextStyles);
142+
const warnedAbout = {};
143+
for (const key in expandedUpdates) {
144+
const originalKey = expandedUpdates[key];
145+
const correctOriginalKey = expandedStyles[key];
146+
if (correctOriginalKey && originalKey !== correctOriginalKey) {
147+
const warningKey = originalKey + ',' + correctOriginalKey;
148+
if (warnedAbout[warningKey]) {
149+
continue;
150+
}
151+
warnedAbout[warningKey] = true;
152152
warning(
153153
false,
154154
'%s a style property during rerender (%s) when a ' +

packages/react-test-renderer/src/ReactShallowRenderer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ function areHookInputsEqual(
6969
'its type cannot change between renders.',
7070
currentHookNameInDev,
7171
);
72+
return false;
7273
}
73-
return false;
7474
}
7575

76-
// Don't bother comparing lengths in prod because these arrays should be
77-
// passed inline.
78-
if (nextDeps.length !== prevDeps.length) {
79-
if (__DEV__) {
76+
if (__DEV__) {
77+
// Don't bother comparing lengths in prod because these arrays should be
78+
// passed inline.
79+
if (nextDeps.length !== prevDeps.length) {
8080
warning(
8181
false,
8282
'The final argument passed to %s changed size between renders. The ' +

0 commit comments

Comments
 (0)