-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled warnAboutDeprecatedLifecycles flag by default #15186
Enabled warnAboutDeprecatedLifecycles flag by default #15186
Conversation
862b335
to
8742dce
Compare
Ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looksgooddidnotread
rightbackatyabuddy |
).toLowPriorityWarnDev( | ||
[ | ||
'componentWillMount is deprecated and will be removed in the next major version. ' + | ||
'Use componentDidMount instead. As a temporary workaround, ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"As a temporary workaround" — people will 100% read it as "UNSAFE_ version will be removed in 17". We've already seen this confusion despite explicit assurances it won't be. We need to emphasize this in the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workaround is still temporary, in that using the (renamed) method is still unsafe.
If you have proposals for an alternate error message, post a PR, but I don't think we should make it sound like ongoing use of the unsafe lifecycles is totally fine either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's better to error on the side of less scary.
It is really unsafe even with "batched" Suspense too, and just generally a risk factor in server rendering. Not just concurrent mode. So you'll likely be left behind one way or another.
So even though we probably won't completely remove it, it's probably a good idea to treat it almost as bad as if we would.
Does it matter if you can upgrade to React 18 but not use any of the new features in it?
Also updated tests to account for this. (Mostly this involved merging some "internal" tests that are no longer internal.)
Note that we still only warn about "unsafe" lifecycle methods in strict mode, but now we will always warn about the "legacy" lifecycles.