From 3720591dda6f469e06fb44b5184e094270d0daf5 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Tue, 27 Aug 2019 14:44:33 +0300 Subject: [PATCH] Don't use componentWillReceiveProps --- .../StripeBankAccountTokenInputField.js | 8 ++++---- src/forms/ProfileSettingsForm/ProfileSettingsForm.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js b/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js index 93eff0ff..96f7cf0d 100644 --- a/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js +++ b/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js @@ -78,14 +78,14 @@ class TokenInputFieldComponent extends Component { this._isMounted = true; } - componentWillReceiveProps(nextProps) { - const countryChanged = nextProps.country !== this.props.country; - const currencyChanged = nextProps.currency !== this.props.currency; + componentDidUpdate(prevProps) { + const countryChanged = this.props.country !== prevProps.country; + const currencyChanged = this.props.currency !== prevProps.currency; if (countryChanged || currencyChanged) { // Clear the possible input values from the state // if the given country or currency changes. this.setState(this.initialState); - nextProps.input.onChange(''); + this.props.input.onChange(''); } } diff --git a/src/forms/ProfileSettingsForm/ProfileSettingsForm.js b/src/forms/ProfileSettingsForm/ProfileSettingsForm.js index 211d7a37..6e8fb664 100644 --- a/src/forms/ProfileSettingsForm/ProfileSettingsForm.js +++ b/src/forms/ProfileSettingsForm/ProfileSettingsForm.js @@ -25,10 +25,10 @@ class ProfileSettingsFormComponent extends Component { this.submittedValues = {}; } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { // Upload delay is additional time window where Avatar is added to the DOM, // but not yet visible (time to load image URL from srcset) - if (this.props.uploadInProgress && !nextProps.uploadInProgress) { + if (prevProps.uploadInProgress && !this.props.uploadInProgress) { this.setState({ uploadDelay: true }); this.uploadDelayTimeoutId = window.setTimeout(() => { this.setState({ uploadDelay: false });