Skip to content
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

Warnings: componentWillReceiveProps in strict mode, Legacy context API, findDOMNode is deprecated #4094

Closed
bladey opened this issue Jun 18, 2020 · 20 comments · Fixed by #4313
Assignees
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020)

Comments

@bladey
Copy link
Contributor

bladey commented Jun 18, 2020

This issue is a round-up of multiple past issues documenting the same bug. Feel free to check out the linked issues below for more information. This issue is the source of truth going forward to investigate the issue, report findings, and implement a bug fix.

Issue:

W35yYs

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.
Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of NodeResolver which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node

Issues:

#3751
#3720
#3915
#3745
#4068
#3703

If anyone would like to share any further information, please do so.

@giangr21

This comment has been minimized.

@Sine99

This comment has been minimized.

@manvydasu
Copy link
Contributor

manvydasu commented Jun 19, 2020

So basically someone would have to create a PR and replace legacy component lifecycle methods with newer version: https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#migrating-from-legacy-lifecycles

However, looking at usages and code inside of UNSAFE_componentWillReceiveProps , it might not be so straightforward.

@stak99

This comment has been minimized.

@corysimmons
Copy link

corysimmons commented Jun 29, 2020

For anyone else going insane over this, you can disable those warnings (and other, actually helpful ones) by commenting out <React.StrictMode> in index.js. Just remember to uncomment it a few times a day to get the helpful warnings.


Update: Stop confused-face'ing me you monsters! 😭

@martijnhalekor

This comment has been minimized.

@roberto-souza

This comment has been minimized.

@OlegPuzankin
Copy link

Can anyone say - are these warnings critical and can we expect the developers to fix that in the future?

@corysimmons
Copy link

@OlegPuzankin They aren't critical in React 16.x.x, in React 17+ I suspect all the deprecated UNSAFE_xyz methods will be removed so any libraries depending on those methods will stop working.

Yes, the maintainer is aware of it and has it on their todo list.

@BraveEvidence
Copy link

React v17 has been released. Someone please fix this issue

@ljharb
Copy link

ljharb commented Oct 24, 2020

The UNSAFE removal has been deferred to React 18.

@Methuselah96
Copy link
Collaborator

Methuselah96 commented Nov 14, 2020

I've started a fork of react-select. Feel free to resubmit this issue on the fork and/or submit a PR to resolve this issue on the fork and we can get it merged and released.

EDIT: 🎉 I've archived the fork now that we've got some momentum in this repo and Jed is involved again. Sorry for the disturbance!

@corysimmons
Copy link

corysimmons commented Nov 25, 2020

@Methuselah96 Is that a drop-in replacement that won't spam the UNSAFE warnings?

Edit: Seems to have the same UNSAFE warnings and others are submitting PRs to that project... so... why not just PR this project instead? 🤔

@Methuselah96
Copy link
Collaborator

Methuselah96 commented Nov 25, 2020

@corysimmons I haven't finished the changes necessary to remove the UNSAFE warnings in the fork.

I didn't make a PR for this project, because at the time, it had been several months since any PR had been merged and half a year since a new version had been released. I planned on creating a PR once I had finished all the changes necessary.

As long as this project is actually maintained, I'll make PRs here and hopefully archive my fork.

EDIT: I've made a PR: #4313.

@bwilson
Copy link

bwilson commented Nov 25, 2020 via email

@flora8984461
Copy link

Have the same issue here.

@Dezzymei
Copy link

I am still getting this issue. I thought this was working with react 17?

@ebonow ebonow removed this from the 4.0 milestone Jan 22, 2021
@ebonow ebonow linked a pull request Jan 22, 2021 that will close this issue
@corysimmons
Copy link

@Methuselah96 Thank you, Hero!

@Ochaun
Copy link

Ochaun commented Feb 25, 2021

Still getting this issue on 4.1.0 for the Animated Select.

@ebonow
Copy link
Collaborator

ebonow commented Feb 25, 2021

@Ochaun this is being tracked in #4456

alwaysblank added a commit to humanmade/hm-gutenberg-tools that referenced this issue Jun 15, 2021
This updates react-select to resolve an error/warning seen when using
this plugin. See JedWatson/react-select#4094
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020)
Projects
None yet
Development

Successfully merging a pull request may close this issue.