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

Failing test for <StrictMode> #918

Closed
wants to merge 2 commits into from
Closed

Failing test for <StrictMode> #918

wants to merge 2 commits into from

Conversation

timdorr
Copy link
Member

@timdorr timdorr commented Apr 2, 2018

Doesn't fix #897. But lets us know what's going to break in future versions of React:

Warning: Unsafe lifecycle methods were found within a strict-mode tree:

    componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: Connect(Container)

    componentWillUpdate: Please update the following components to use componentDidUpdate instead: Connect(Container)

    Learn more about this warning here:
    https://fb.me/react-strict-mode-warnings

If others want to fix this, you can use this branch as a base. Feel free to try it out!

@timdorr timdorr mentioned this pull request Apr 2, 2018
@theKashey
Copy link

theKashey commented Apr 3, 2018

In terms of React-Hot-Loader componentWillUpdate could not be replaced by componentDidRender, as long RHL needs to being able render "a new" Connected component, not a cached version :(
Something major should be changed.

@timdorr
Copy link
Member Author

timdorr commented Apr 3, 2018

@theKashey We may be able to use the new getSnapshotBeforeUpdate and cDU while keeping oldListeners around between the two (or going up to the top module level).

@theKashey
Copy link

theKashey commented Apr 6, 2018

Or just not cache rendered component :)
If a new state will be calculated in getDerivedStateFromProps, then it is possible just to cancel the unnecessary render. (and react-hot-loader will bypass this cancel)

Trying to find that cached component I am talking about, and could not find anything....

Anyway - using componentDidUpdate should be ok. And why should component reconnect to the store, not just update selector?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix <StrictMode> warnings
2 participants