use a different link in the UNSAFE_ component warnings (#16321)
When React detects a deprectated/unsafe lifecycle method, the warning points to a page with more details on the why/what of the warning. However, the actual link (https://fb.me/react-async-component-lifecycle-hooks) uses the phrase "lifecycle-hooks" which is confusing since it doesn't have anything to do with hooks. This PR changes the link to something less confusing - https://fb.me/react-unsafe-component-lifecycles.
Sunil Pai committed
Aug 9, 2019 at 12:18 UTC
66a474227b18c76eb2f7c24108227e8628502f8c
6 files changed
+30
-30
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
+11
-11
@@ -811,7 +811,7 @@ describe('ReactComponentLifeCycle', () => {
811
' UNSAFE_componentWillReceiveProps\n' +
812
' componentWillUpdate\n\n' +
813
'The above lifecycles should be removed. Learn more about this warning here:\n' +
814
- 'https://fb.me/react-async-component-lifecycle-hooks',
814
+ 'https://fb.me/react-unsafe-component-lifecycles',
815
{withoutStack: true},
816
);
817
}).toLowPriorityWarnDev(
@@ -838,7 +838,7 @@ describe('ReactComponentLifeCycle', () => {
838
'WillMount uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
839
' UNSAFE_componentWillMount\n\n' +
840
'The above lifecycles should be removed. Learn more about this warning here:\n' +
841
- 'https://fb.me/react-async-component-lifecycle-hooks',
841
+ 'https://fb.me/react-unsafe-component-lifecycles',
842
{withoutStack: true},
843
);
844
@@ -863,7 +863,7 @@ describe('ReactComponentLifeCycle', () => {
863
' componentWillMount\n' +
864
' UNSAFE_componentWillUpdate\n\n' +
865
'The above lifecycles should be removed. Learn more about this warning here:\n' +
866
- 'https://fb.me/react-async-component-lifecycle-hooks',
866
+ 'https://fb.me/react-unsafe-component-lifecycles',
867
{withoutStack: true},
868
);
869
}).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
@@ -887,7 +887,7 @@ describe('ReactComponentLifeCycle', () => {
887
'WillReceiveProps uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
888
' componentWillReceiveProps\n\n' +
889
'The above lifecycles should be removed. Learn more about this warning here:\n' +
890
- 'https://fb.me/react-async-component-lifecycle-hooks',
890
+ 'https://fb.me/react-unsafe-component-lifecycles',
891
{withoutStack: true},
892
);
893
}).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
@@ -920,7 +920,7 @@ describe('ReactComponentLifeCycle', () => {
920
' UNSAFE_componentWillReceiveProps\n' +
921
' componentWillUpdate\n\n' +
922
'The above lifecycles should be removed. Learn more about this warning here:\n' +
923
- 'https://fb.me/react-async-component-lifecycle-hooks',
923
+ 'https://fb.me/react-unsafe-component-lifecycles',
924
{withoutStack: true},
925
);
926
}).toLowPriorityWarnDev(
@@ -946,7 +946,7 @@ describe('ReactComponentLifeCycle', () => {
946
'WillMount uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
947
' UNSAFE_componentWillMount\n\n' +
948
'The above lifecycles should be removed. Learn more about this warning here:\n' +
949
- 'https://fb.me/react-async-component-lifecycle-hooks',
949
+ 'https://fb.me/react-unsafe-component-lifecycles',
950
{withoutStack: true},
951
);
952
@@ -970,7 +970,7 @@ describe('ReactComponentLifeCycle', () => {
970
' componentWillMount\n' +
971
' UNSAFE_componentWillUpdate\n\n' +
972
'The above lifecycles should be removed. Learn more about this warning here:\n' +
973
- 'https://fb.me/react-async-component-lifecycle-hooks',
973
+ 'https://fb.me/react-unsafe-component-lifecycles',
974
{withoutStack: true},
975
);
976
}).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
@@ -993,7 +993,7 @@ describe('ReactComponentLifeCycle', () => {
993
'WillReceiveProps uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
994
' componentWillReceiveProps\n\n' +
995
'The above lifecycles should be removed. Learn more about this warning here:\n' +
996
- 'https://fb.me/react-async-component-lifecycle-hooks',
996
+ 'https://fb.me/react-unsafe-component-lifecycles',
997
{withoutStack: true},
998
);
999
}).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
@@ -1410,20 +1410,20 @@ describe('ReactComponentLifeCycle', () => {
1410
).toLowPriorityWarnDev(
1411
[
1412
/* eslint-disable max-len */
1413
- `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1413
+ `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
1414
1415
* Move code with side effects to componentDidMount, and set initial state in the constructor.
1416
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1417
1418
Please update the following components: MyComponent`,
1419
- `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1419
+ `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
1420
1421
* Move data fetching code or side effects to componentDidUpdate.
1422
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
1423
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1424
1425
Please update the following components: MyComponent`,
1426
- `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1426
+ `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
1427
1428
* Move data fetching code or side effects to componentDidUpdate.
1429
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
packages/react-dom/src/server/ReactPartialRenderer.js
+1
-1
@@ -583,7 +583,7 @@ function resolve(
583
false,
584
// keep this warning in sync with ReactStrictModeWarning.js
585
'componentWillMount has been renamed, and is not recommended for use. ' +
586
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
586
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
587
'* Move code from componentWillMount to componentDidMount (preferred in most cases) ' +
588
'or the constructor.\n' +
589
'\nPlease update the following components: %s',
packages/react-reconciler/src/ReactFiberClassComponent.js
+1
-1
@@ -702,7 +702,7 @@ function constructClassInstance(
702
'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
703
'%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' +
704
'The above lifecycles should be removed. Learn more about this warning here:\n' +
705
- 'https://fb.me/react-async-component-lifecycle-hooks',
705
+ 'https://fb.me/react-unsafe-component-lifecycles',
706
componentName,
707
newApiName,
708
foundWillMountName !== null ? `\n ${foundWillMountName}` : '',
packages/react-reconciler/src/ReactStrictModeWarnings.js
+6
-6
@@ -194,7 +194,7 @@ if (__DEV__) {
194
warningWithoutStack(
195
false,
196
'Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' +
197
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
197
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
198
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
199
'\nPlease update the following components: %s',
200
sortedNames,
@@ -209,7 +209,7 @@ if (__DEV__) {
209
false,
210
'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' +
211
'and may indicate bugs in your code. ' +
212
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
212
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
213
'* Move data fetching code or side effects to componentDidUpdate.\n' +
214
"* If you're updating state whenever props change, " +
215
'refactor your code to use memoization techniques or move it to ' +
@@ -227,7 +227,7 @@ if (__DEV__) {
227
false,
228
'Using UNSAFE_componentWillUpdate in strict mode is not recommended ' +
229
'and may indicate bugs in your code. ' +
230
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
230
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
231
'* Move data fetching code or side effects to componentDidUpdate.\n' +
232
'\nPlease update the following components: %s',
233
sortedNames,
@@ -240,7 +240,7 @@ if (__DEV__) {
240
lowPriorityWarning(
241
false,
242
'componentWillMount has been renamed, and is not recommended for use. ' +
243
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
243
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
244
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
245
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
246
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
@@ -259,7 +259,7 @@ if (__DEV__) {
259
lowPriorityWarning(
260
false,
261
'componentWillReceiveProps has been renamed, and is not recommended for use. ' +
262
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
262
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
263
'* Move data fetching code or side effects to componentDidUpdate.\n' +
264
"* If you're updating state whenever props change, refactor your " +
265
'code to use memoization techniques or move it to ' +
@@ -279,7 +279,7 @@ if (__DEV__) {
279
lowPriorityWarning(
280
false,
281
'componentWillUpdate has been renamed, and is not recommended for use. ' +
282
- 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' +
282
+ 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
283
'* Move data fetching code or side effects to componentDidUpdate.\n' +
284
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
285
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
packages/react/src/__tests__/ReactStrictMode-test.internal.js
+9
-9
@@ -351,18 +351,18 @@ describe('ReactStrictMode', () => {
351
expect(() => Scheduler.unstable_flushAll()).toWarnDev(
352
[
353
/* eslint-disable max-len */
354
- `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
354
+ `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
355
356
* Move code with side effects to componentDidMount, and set initial state in the constructor.
357
358
Please update the following components: AsyncRoot`,
359
- `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
359
+ `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
360
361
* Move data fetching code or side effects to componentDidUpdate.
362
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
363
364
Please update the following components: Bar, Foo`,
365
- `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
365
+ `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
366
367
* Move data fetching code or side effects to componentDidUpdate.
368
@@ -409,18 +409,18 @@ Please update the following components: AsyncRoot`,
409
expect(() => Scheduler.unstable_flushAll()).toWarnDev(
410
[
411
/* eslint-disable max-len */
412
- `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
412
+ `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
413
414
* Move code with side effects to componentDidMount, and set initial state in the constructor.
415
416
Please update the following components: AsyncRoot`,
417
- `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
417
+ `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
418
419
* Move data fetching code or side effects to componentDidUpdate.
420
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
421
422
Please update the following components: Child`,
423
- `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-async-component-lifecycle-hooks for details.
423
+ `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
424
425
* Move data fetching code or side effects to componentDidUpdate.
426
@@ -432,20 +432,20 @@ Please update the following components: AsyncRoot`,
432
}).toLowPriorityWarnDev(
433
[
434
/* eslint-disable max-len */
435
- `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
435
+ `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
436
437
* Move code with side effects to componentDidMount, and set initial state in the constructor.
438
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
439
440
Please update the following components: Parent`,
441
- `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
441
+ `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
442
443
* Move data fetching code or side effects to componentDidUpdate.
444
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
445
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
446
447
Please update the following components: Parent`,
448
- `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
448
+ `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
449
450
* Move data fetching code or side effects to componentDidUpdate.
451
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
packages/react/src/__tests__/createReactClassIntegration-test.js
+2
-2
@@ -559,7 +559,7 @@ describe('create-react-class-integration', () => {
559
' componentWillReceiveProps\n' +
560
' componentWillUpdate\n\n' +
561
'The above lifecycles should be removed. Learn more about this warning here:\n' +
562
- 'https://fb.me/react-async-component-lifecycle-hooks',
562
+ 'https://fb.me/react-unsafe-component-lifecycles',
563
{withoutStack: true},
564
);
565
}).toLowPriorityWarnDev(
@@ -603,7 +603,7 @@ describe('create-react-class-integration', () => {
603
' componentWillReceiveProps\n' +
604
' componentWillUpdate\n\n' +
605
'The above lifecycles should be removed. Learn more about this warning here:\n' +
606
- 'https://fb.me/react-async-component-lifecycle-hooks',
606
+ 'https://fb.me/react-unsafe-component-lifecycles',
607
{withoutStack: true},
608
);
609
}).toLowPriorityWarnDev(