@samitouri / QOS-React / commits / f05296baf5

Changed cWM/cWRP/cWU deprecations to low-pri warnings (#12159)

Brian Vaughn committed Feb 5, 2018 at 13:39 UTC f05296baf586dc8e6d6e6a3e6d666c8dd8e4ccd5
6 files changed +25 -12
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.internal.js
+3 -1
@@ -41,7 +41,9 @@ describe('ReactComponentLifeCycle', () => {
41 }
42
43 const container = document.createElement('div');
44 - expect(() => ReactDOM.render(<MyComponent x={1} />, container)).toWarnDev([
44 + expect(() =>
45 + ReactDOM.render(<MyComponent x={1} />, container),
46 + ).toLowPriorityWarnDev([
47 'componentWillMount is deprecated and will be removed in the next major version. ' +
48 'Use componentDidMount instead. As a temporary workaround, ' +
49 'you can rename to UNSAFE_componentWillMount.' +
packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.internal.js
+6 -2
@@ -40,7 +40,9 @@ describe('ReactDOMServerLifecycles', () => {
40 }
41 }
42
43 - expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
43 + expect(() =>
44 + ReactDOMServer.renderToString(<Component />),
45 + ).toLowPriorityWarnDev(
46 'Component: componentWillMount() is deprecated and will be removed in the next major version.',
47 );
48 });
@@ -55,7 +57,9 @@ describe('ReactDOMServerLifecycles', () => {
57 }
58 }
59
58 - expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
60 + expect(() =>
61 + ReactDOMServer.renderToString(<Component />),
62 + ).toLowPriorityWarnDev(
63 'Warning: Component: componentWillMount() is deprecated and will be removed ' +
64 'in the next major version.',
65 );
packages/react-dom/src/server/ReactPartialRenderer.js
+2 -1
@@ -19,6 +19,7 @@ import emptyFunction from 'fbjs/lib/emptyFunction';
19 import emptyObject from 'fbjs/lib/emptyObject';
20 import hyphenateStyleName from 'fbjs/lib/hyphenateStyleName';
21 import invariant from 'fbjs/lib/invariant';
22 +import lowPriorityWarning from 'shared/lowPriorityWarning';
23 import memoizeStringOnly from 'fbjs/lib/memoizeStringOnly';
24 import warning from 'fbjs/lib/warning';
25 import checkPropTypes from 'prop-types/checkPropTypes';
@@ -524,7 +525,7 @@ function resolve(
525 const componentName = getComponentName(Component) || 'Unknown';
526
527 if (!didWarnAboutDeprecatedWillMount[componentName]) {
527 - warning(
528 + lowPriorityWarning(
529 false,
530 '%s: componentWillMount() is deprecated and will be ' +
531 'removed in the next major version. Read about the motivations ' +
packages/react-reconciler/src/ReactStrictModeWarnings.js
+4 -3
@@ -12,6 +12,7 @@ import type {Fiber} from './ReactFiber';
12 import getComponentName from 'shared/getComponentName';
13 import {getStackAddendumByWorkInProgressFiber} from 'shared/ReactFiberComponentTreeHook';
14 import {StrictMode} from './ReactTypeOfMode';
15 +import lowPriorityWarning from 'shared/lowPriorityWarning';
16 import warning from 'fbjs/lib/warning';
17
18 type LIFECYCLE =
@@ -126,7 +127,7 @@ if (__DEV__) {
127 .sort()
128 .join(', ');
129
129 - warning(
130 + lowPriorityWarning(
131 false,
132 'componentWillMount is deprecated and will be removed in the next major version. ' +
133 'Use componentDidMount instead. As a temporary workaround, ' +
@@ -151,7 +152,7 @@ if (__DEV__) {
152 .sort()
153 .join(', ');
154
154 - warning(
155 + lowPriorityWarning(
156 false,
157 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' +
158 'Use static getDerivedStateFromProps instead.' +
@@ -175,7 +176,7 @@ if (__DEV__) {
176 .sort()
177 .join(', ');
178
178 - warning(
179 + lowPriorityWarning(
180 false,
181 'componentWillUpdate is deprecated and will be removed in the next major version. ' +
182 'Use componentDidUpdate instead. As a temporary workaround, ' +
packages/react-test-renderer/src/ReactShallowRenderer.js
+4 -3
@@ -12,6 +12,7 @@ import describeComponentFrame from 'shared/describeComponentFrame';
12 import getComponentName from 'shared/getComponentName';
13 import emptyObject from 'fbjs/lib/emptyObject';
14 import invariant from 'fbjs/lib/invariant';
15 +import lowPriorityWarning from 'shared/lowPriorityWarning';
16 import shallowEqual from 'fbjs/lib/shallowEqual';
17 import checkPropTypes from 'prop-types/checkPropTypes';
18 import warning from 'fbjs/lib/warning';
@@ -188,7 +189,7 @@ class ReactShallowRenderer {
189 ) {
190 const componentName = getName(element.type, this._instance);
191 if (!didWarnAboutLegacyWillMount[componentName]) {
191 - warning(
192 + lowPriorityWarning(
193 false,
194 '%s: componentWillMount() is deprecated and will be ' +
195 'removed in the next major version. Read about the motivations ' +
@@ -242,7 +243,7 @@ class ReactShallowRenderer {
243 if (warnAboutDeprecatedLifecycles) {
244 const componentName = getName(element.type, this._instance);
245 if (!didWarnAboutLegacyWillReceiveProps[componentName]) {
245 - warning(
246 + lowPriorityWarning(
247 false,
248 '%s: componentWillReceiveProps() is deprecated and ' +
249 'will be removed in the next major version. Use ' +
@@ -300,7 +301,7 @@ class ReactShallowRenderer {
301 if (warnAboutDeprecatedLifecycles) {
302 const componentName = getName(element.type, this._instance);
303 if (!didWarnAboutLegacyWillUpdate[componentName]) {
303 - warning(
304 + lowPriorityWarning(
305 false,
306 '%s: componentWillUpdate() is deprecated and will be ' +
307 'removed in the next major version. Read about the motivations ' +
packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.internal.js
+6 -2
@@ -40,11 +40,15 @@ describe('ReactShallowRenderer', () => {
40 }
41
42 const shallowRenderer = createRenderer();
43 - expect(() => shallowRenderer.render(<ComponentWithWarnings />)).toWarnDev(
43 + expect(() =>
44 + shallowRenderer.render(<ComponentWithWarnings />),
45 + ).toLowPriorityWarnDev(
46 'Warning: ComponentWithWarnings: componentWillMount() is deprecated and will ' +
47 'be removed in the next major version.',
48 );
47 - expect(() => shallowRenderer.render(<ComponentWithWarnings />)).toWarnDev([
49 + expect(() =>
50 + shallowRenderer.render(<ComponentWithWarnings />),
51 + ).toLowPriorityWarnDev([
52 'Warning: ComponentWithWarnings: componentWillReceiveProps() is deprecated ' +
53 'and will be removed in the next major version.',
54 'Warning: ComponentWithWarnings: componentWillUpdate() is deprecated and will ' +