From 148f163e404a3ad1dba9a346f30e479ec223a4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Hodierne?= Date: Sat, 19 May 2018 15:30:00 +0200 Subject: [PATCH] fix: rename React unsafe lifecyle methods --- src/components/CreateCollectiveForm.js | 2 +- src/components/CreateExpenseForm.js | 2 +- src/components/EditCollectiveForm.js | 2 +- src/components/EditEventForm.js | 2 +- src/components/InputField.js | 2 +- src/components/InputTypeCreditCard.js | 2 +- src/components/InputTypeLocation.js | 2 +- src/components/MatchingFundWithData.js | 2 +- src/components/OrderForm.js | 4 ++-- src/components/PaymentMethodChooser.js | 2 +- src/components/Subscriptions.js | 2 +- src/components/TransactionsWithData.js | 2 +- src/components/UpdatesWithData.js | 2 +- src/pages/banner-iframe.js | 2 +- src/pages/createOrder.js | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/CreateCollectiveForm.js b/src/components/CreateCollectiveForm.js index 429835fecd9..24383149a2a 100644 --- a/src/components/CreateCollectiveForm.js +++ b/src/components/CreateCollectiveForm.js @@ -80,7 +80,7 @@ class CreateCollectiveForm extends React.Component { } } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.collective && (!this.props.collective || get(nextProps, 'collective.name') != get(this.props, 'collective.name'))) { this.setState({ collective: nextProps.collective, tiers: nextProps.collective.tiers }); } diff --git a/src/components/CreateExpenseForm.js b/src/components/CreateExpenseForm.js index 2d0728bf376..046a5d0fb42 100644 --- a/src/components/CreateExpenseForm.js +++ b/src/components/CreateExpenseForm.js @@ -97,7 +97,7 @@ class CreateExpenseForm extends React.Component { this.props.onChange && this.props.onChange(expense); } - componentWillReceiveProps(newProps) { + UNSAFE_componentWillReceiveProps(newProps) { if (!this.props.LoggedInUser && newProps.LoggedInUser && !this.state.expense.paypalEmail) { this.handleChange('paypalEmail', newProps.LoggedInUser.paypalEmail); } diff --git a/src/components/EditCollectiveForm.js b/src/components/EditCollectiveForm.js index 0196c5506c4..3115d401b2c 100644 --- a/src/components/EditCollectiveForm.js +++ b/src/components/EditCollectiveForm.js @@ -93,7 +93,7 @@ class EditCollectiveForm extends React.Component { } } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.collective && (!this.props.collective || nextProps.collective.name != this.props.collective.name)) { this.setState({ collective: nextProps.collective, tiers: nextProps.collective.tiers }); } diff --git a/src/components/EditEventForm.js b/src/components/EditEventForm.js index e11fe8ba921..ed2f8620635 100644 --- a/src/components/EditEventForm.js +++ b/src/components/EditEventForm.js @@ -36,7 +36,7 @@ class EditEventForm extends React.Component { } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.event && (!this.props.event || nextProps.event.name != this.props.event.name)) { this.setState({ event: nextProps.event, tiers: nextProps.event.tiers }); } diff --git a/src/components/InputField.js b/src/components/InputField.js index 757e769c580..8599fd0672b 100644 --- a/src/components/InputField.js +++ b/src/components/InputField.js @@ -93,7 +93,7 @@ class InputField extends React.Component { } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.value != this.props.value) { this.setState({value: nextProps.value}); } diff --git a/src/components/InputTypeCreditCard.js b/src/components/InputTypeCreditCard.js index 0fc7a34a6f2..f9b843e31e0 100644 --- a/src/components/InputTypeCreditCard.js +++ b/src/components/InputTypeCreditCard.js @@ -55,7 +55,7 @@ class InputTypeCreditCard extends React.Component { } } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.options && nextProps.options.length > 0) { if (typeof this.state.uuid !== 'string') { this.handleChange("uuid", nextProps.options[0].uuid); diff --git a/src/components/InputTypeLocation.js b/src/components/InputTypeLocation.js index 88dc952ad7b..6656d05da0f 100644 --- a/src/components/InputTypeLocation.js +++ b/src/components/InputTypeLocation.js @@ -19,7 +19,7 @@ class InputTypeLocation extends React.Component { this.state = { value: props.value || {} }; } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.value != this.props.value) { this.setState({value: nextProps.value}); } diff --git a/src/components/MatchingFundWithData.js b/src/components/MatchingFundWithData.js index ec5d1306832..1353249a70e 100644 --- a/src/components/MatchingFundWithData.js +++ b/src/components/MatchingFundWithData.js @@ -25,7 +25,7 @@ class MatchingFundWithData extends React.Component { } // Whenever this.props.order.totalAmount changes, we update the status - async componentWillReceiveProps(newProps) { + async UNSAFE_componentWillReceiveProps(newProps) { const { data: { loading, MatchingFund }, collective, order, uuid } = newProps; if (loading) return; diff --git a/src/components/OrderForm.js b/src/components/OrderForm.js index 486c7848e57..eb01950f244 100644 --- a/src/components/OrderForm.js +++ b/src/components/OrderForm.js @@ -168,7 +168,7 @@ class OrderForm extends React.Component { componentDidMount() { this._isMounted = true; - this.componentWillReceiveProps(this.props); + this.UNSAFE_componentWillReceiveProps(this.props); } populatePaymentMethodTypes() { @@ -251,7 +251,7 @@ class OrderForm extends React.Component { return fromCollectiveOptions; } - componentWillReceiveProps(props) { + UNSAFE_componentWillReceiveProps(props) { const { LoggedInUser } = props; if (!LoggedInUser) return; if (!this._isMounted) return; // Fixes error: Can only update a mounted or mounting component diff --git a/src/components/PaymentMethodChooser.js b/src/components/PaymentMethodChooser.js index f055ffee5db..8619f3543e1 100644 --- a/src/components/PaymentMethodChooser.js +++ b/src/components/PaymentMethodChooser.js @@ -48,7 +48,7 @@ class PaymentMethodChooser extends React.Component { }); } - componentWillReceiveProps(newProps) { + UNSAFE_componentWillReceiveProps(newProps) { // TODO: Remove these hacky fixes // Most likely means need to rework the logic split between this and SubscriptionCard component diff --git a/src/components/Subscriptions.js b/src/components/Subscriptions.js index a1bf7cf433e..6018ba44265 100644 --- a/src/components/Subscriptions.js +++ b/src/components/Subscriptions.js @@ -25,7 +25,7 @@ class Subscriptions extends React.Component { }) } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (!this.props.LoggedInUser && nextProps.LoggedInUser) { return this.props.refetch(); } diff --git a/src/components/TransactionsWithData.js b/src/components/TransactionsWithData.js index 480853eac5c..863bd6aba62 100644 --- a/src/components/TransactionsWithData.js +++ b/src/components/TransactionsWithData.js @@ -19,7 +19,7 @@ class TransactionsWithData extends React.Component { super(props); } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (!this.props.LoggedInUser && nextProps.LoggedInUser) { return this.props.data.refetch(); } diff --git a/src/components/UpdatesWithData.js b/src/components/UpdatesWithData.js index 40caa25482b..6a4406b85e6 100644 --- a/src/components/UpdatesWithData.js +++ b/src/components/UpdatesWithData.js @@ -26,7 +26,7 @@ class UpdatesWithData extends React.Component { } } - componentWillReceiveProps(newProps) { + UNSAFE_componentWillReceiveProps(newProps) { const { data, collective } = this.props; const { LoggedInUser } = newProps; if (LoggedInUser && LoggedInUser.canEditCollective(collective)) { diff --git a/src/pages/banner-iframe.js b/src/pages/banner-iframe.js index 7cb88c2a03c..57028f1b358 100644 --- a/src/pages/banner-iframe.js +++ b/src/pages/banner-iframe.js @@ -31,7 +31,7 @@ class Banner extends React.Component { this.sendMessageToParentWindow(); } - componentWillReceiveProps() { + UNSAFE_componentWillReceiveProps() { this.onChange(); } diff --git a/src/pages/createOrder.js b/src/pages/createOrder.js index f3fbe7d9c3e..fafa03bb316 100644 --- a/src/pages/createOrder.js +++ b/src/pages/createOrder.js @@ -81,7 +81,7 @@ class CreateOrderPage extends React.Component { this.setState(newState); } - componentWillReceiveProps(newProps) { + UNSAFE_componentWillReceiveProps(newProps) { if (this.state.matchingFund) return; const matchingFund = get(newProps, 'data.Collective.settings.matchingFund'); if (matchingFund) {