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

Remove use of componentWillReceiveProps() in UserProfileEdit #7874

Merged
merged 1 commit into from Apr 12, 2019

Conversation

willdurand
Copy link
Member

@willdurand willdurand commented Apr 11, 2019

Fixes mozilla/addons#12595


This is similar to other patches.

It is needed to upgrade Enzyme to 3.9.0 which, in turn, should allow us to use getDerivedStateFromProps() in this component to get rid of the setState calls in componentDidUpdate() (there is a known Enzyme issue about that).

It is not recommended to use setState in componentDidUpdate() but it is possible. The only potential problem is infinite loops but we have enough guards in place to avoid that, so I don't think we'll run into issues. That being said, once this patch lands and we upgrade to Enzyme 3.9.0, I'll try to rewrite the logic with getDerivedStateFromProps() (cf. mozilla/addons#2071).

@codecov-io
Copy link

codecov-io commented Apr 11, 2019

Codecov Report

Merging #7874 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    mozilla/addons-frontend#7874   +/-   ##
=======================================
  Coverage   98.04%   98.04%           
=======================================
  Files         259      259           
  Lines        7151     7151           
  Branches     1322     1322           
=======================================
  Hits         7011     7011           
  Misses        126      126           
  Partials       14       14
Impacted Files Coverage Δ
src/amo/pages/UserProfileEdit/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b301de1...7b4a34a. Read the comment docs.

@willdurand willdurand marked this pull request as ready for review April 11, 2019 13:07
Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good idea

@willdurand willdurand merged commit e40a31f into master Apr 12, 2019
@willdurand willdurand deleted the remove-cwrp branch April 12, 2019 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants