Wraps two warnings that should be removed from PROD (#10315)
Dominic Gannaway committed
Jul 27, 2017 at 11:24 UTC
6b3b9b5563a63447f75d93d6324a0db34d9b2472
3 files changed
+22
-16
src/renderers/dom/fiber/wrappers/ReactDOMFiberSelect.js
+16
-14
@@ -148,20 +148,22 @@ var ReactDOMSelect = {
148
wasMultiple: !!props.multiple,
149
};
150
151
- if (
152
- props.value !== undefined &&
153
- props.defaultValue !== undefined &&
154
- !didWarnValueDefaultValue
155
- ) {
156
- warning(
157
- false,
158
- 'Select elements must be either controlled or uncontrolled ' +
159
- '(specify either the value prop, or the defaultValue prop, but not ' +
160
- 'both). Decide between using a controlled or uncontrolled select ' +
161
- 'element and remove one of these props. More info: ' +
162
- 'https://fb.me/react-controlled-components',
163
- );
164
- didWarnValueDefaultValue = true;
151
+ if (__DEV__) {
152
+ if (
153
+ props.value !== undefined &&
154
+ props.defaultValue !== undefined &&
155
+ !didWarnValueDefaultValue
156
+ ) {
157
+ warning(
158
+ false,
159
+ 'Select elements must be either controlled or uncontrolled ' +
160
+ '(specify either the value prop, or the defaultValue prop, but not ' +
161
+ 'both). Decide between using a controlled or uncontrolled select ' +
162
+ 'element and remove one of these props. More info: ' +
163
+ 'https://fb.me/react-controlled-components',
164
+ );
165
+ didWarnValueDefaultValue = true;
166
+ }
167
}
168
},
169
src/renderers/dom/shared/DOMMarkupOperations.js
+3
-1
@@ -42,7 +42,9 @@ function isAttributeNameSafe(attributeName) {
42
return true;
43
}
44
illegalAttributeNameCache[attributeName] = true;
45
- warning(false, 'Invalid attribute name: `%s`', attributeName);
45
+ if (__DEV__) {
46
+ warning(false, 'Invalid attribute name: `%s`', attributeName);
47
+ }
48
return false;
49
}
50
src/renderers/dom/shared/DOMPropertyOperations.js
+3
-1
@@ -42,7 +42,9 @@ function isAttributeNameSafe(attributeName) {
42
return true;
43
}
44
illegalAttributeNameCache[attributeName] = true;
45
- warning(false, 'Invalid attribute name: `%s`', attributeName);
45
+ if (__DEV__) {
46
+ warning(false, 'Invalid attribute name: `%s`', attributeName);
47
+ }
48
return false;
49
}
50