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

This commit is contained in:
Brian Vaughn authored and GitHub committed 2018-02-05 13:39:07 -08:00
1 parent 86914cb30a
commit f05296baf5
6 files changed
+25 -12

No files matched your search

@@ -41,7 +41,9 @@ describe('ReactComponentLifeCycle', () => {
}
const container = document.createElement('div');
expect(() => ReactDOM.render(<MyComponent x={1} />, container)).toWarnDev([
expect(() =>
ReactDOM.render(<MyComponent x={1} />, container),
).toLowPriorityWarnDev([
'componentWillMount is deprecated and will be removed in the next major version. ' +
'Use componentDidMount instead. As a temporary workaround, ' +
'you can rename to UNSAFE_componentWillMount.' +
@@ -40,7 +40,9 @@ describe('ReactDOMServerLifecycles', () => {
}
}
expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
expect(() =>
ReactDOMServer.renderToString(<Component />),
).toLowPriorityWarnDev(
'Component: componentWillMount() is deprecated and will be removed in the next major version.',
);
});
@@ -55,7 +57,9 @@ describe('ReactDOMServerLifecycles', () => {
}
}
expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
expect(() =>
ReactDOMServer.renderToString(<Component />),
).toLowPriorityWarnDev(
'Warning: Component: componentWillMount() is deprecated and will be removed ' +
'in the next major version.',
);
+2 -1
View File
@@ -19,6 +19,7 @@ import emptyFunction from 'fbjs/lib/emptyFunction';
import emptyObject from 'fbjs/lib/emptyObject';
import hyphenateStyleName from 'fbjs/lib/hyphenateStyleName';
import invariant from 'fbjs/lib/invariant';
import lowPriorityWarning from 'shared/lowPriorityWarning';
import memoizeStringOnly from 'fbjs/lib/memoizeStringOnly';
import warning from 'fbjs/lib/warning';
import checkPropTypes from 'prop-types/checkPropTypes';
@@ -524,7 +525,7 @@ function resolve(
const componentName = getComponentName(Component) || 'Unknown';
if (!didWarnAboutDeprecatedWillMount[componentName]) {
warning(
lowPriorityWarning(
false,
'%s: componentWillMount() is deprecated and will be ' +
'removed in the next major version. Read about the motivations ' +
+4 -3
View File
@@ -12,6 +12,7 @@ import type {Fiber} from './ReactFiber';
import getComponentName from 'shared/getComponentName';
import {getStackAddendumByWorkInProgressFiber} from 'shared/ReactFiberComponentTreeHook';
import {StrictMode} from './ReactTypeOfMode';
import lowPriorityWarning from 'shared/lowPriorityWarning';
import warning from 'fbjs/lib/warning';
type LIFECYCLE =
@@ -126,7 +127,7 @@ if (__DEV__) {
.sort()
.join(', ');
warning(
lowPriorityWarning(
false,
'componentWillMount is deprecated and will be removed in the next major version. ' +
'Use componentDidMount instead. As a temporary workaround, ' +
@@ -151,7 +152,7 @@ if (__DEV__) {
.sort()
.join(', ');
warning(
lowPriorityWarning(
false,
'componentWillReceiveProps is deprecated and will be removed in the next major version. ' +
'Use static getDerivedStateFromProps instead.' +
@@ -175,7 +176,7 @@ if (__DEV__) {
.sort()
.join(', ');
warning(
lowPriorityWarning(
false,
'componentWillUpdate is deprecated and will be removed in the next major version. ' +
'Use componentDidUpdate instead. As a temporary workaround, ' +
+4 -3
View File
@@ -12,6 +12,7 @@ import describeComponentFrame from 'shared/describeComponentFrame';
import getComponentName from 'shared/getComponentName';
import emptyObject from 'fbjs/lib/emptyObject';
import invariant from 'fbjs/lib/invariant';
import lowPriorityWarning from 'shared/lowPriorityWarning';
import shallowEqual from 'fbjs/lib/shallowEqual';
import checkPropTypes from 'prop-types/checkPropTypes';
import warning from 'fbjs/lib/warning';
@@ -188,7 +189,7 @@ class ReactShallowRenderer {
) {
const componentName = getName(element.type, this._instance);
if (!didWarnAboutLegacyWillMount[componentName]) {
warning(
lowPriorityWarning(
false,
'%s: componentWillMount() is deprecated and will be ' +
'removed in the next major version. Read about the motivations ' +
@@ -242,7 +243,7 @@ class ReactShallowRenderer {
if (warnAboutDeprecatedLifecycles) {
const componentName = getName(element.type, this._instance);
if (!didWarnAboutLegacyWillReceiveProps[componentName]) {
warning(
lowPriorityWarning(
false,
'%s: componentWillReceiveProps() is deprecated and ' +
'will be removed in the next major version. Use ' +
@@ -300,7 +301,7 @@ class ReactShallowRenderer {
if (warnAboutDeprecatedLifecycles) {
const componentName = getName(element.type, this._instance);
if (!didWarnAboutLegacyWillUpdate[componentName]) {
warning(
lowPriorityWarning(
false,
'%s: componentWillUpdate() is deprecated and will be ' +
'removed in the next major version. Read about the motivations ' +
@@ -40,11 +40,15 @@ describe('ReactShallowRenderer', () => {
}
const shallowRenderer = createRenderer();
expect(() => shallowRenderer.render(<ComponentWithWarnings />)).toWarnDev(
expect(() =>
shallowRenderer.render(<ComponentWithWarnings />),
).toLowPriorityWarnDev(
'Warning: ComponentWithWarnings: componentWillMount() is deprecated and will ' +
'be removed in the next major version.',
);
expect(() => shallowRenderer.render(<ComponentWithWarnings />)).toWarnDev([
expect(() =>
shallowRenderer.render(<ComponentWithWarnings />),
).toLowPriorityWarnDev([
'Warning: ComponentWithWarnings: componentWillReceiveProps() is deprecated ' +
'and will be removed in the next major version.',
'Warning: ComponentWithWarnings: componentWillUpdate() is deprecated and will ' +