Skip to content

Commit

Permalink
fix: rename react unsafe lifecyle methods
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed May 19, 2018
1 parent 187e138 commit 5ec95ed
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/components/CreateCollectiveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateCollectiveForm extends React.Component {
this.handleChange = this.handleChange.bind(this);
this.handleObjectChange = this.handleObjectChange.bind(this);

const collective = { ... props.collective || {} };
const collective = { ... (props.collective || {}) };
collective.slug = collective.slug ? collective.slug.replace(/.*\//, '') : '';

this.messages = defineMessages({
Expand Down Expand Up @@ -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 });
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreateExpenseForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditCollectiveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class EditCollectiveForm extends React.Component {
this.handleObjectChange = this.handleObjectChange.bind(this);
this.showSection = this.showSection.bind(this);

const collective = { ... props.collective || {} };
const collective = { ... (props.collective || {}) };
collective.slug = collective.slug ? collective.slug.replace(/.*\//, '') : '';

this.state = {
Expand Down Expand Up @@ -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 });
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditEventForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EditEventForm extends React.Component {
this.handleChange = this.handleChange.bind(this);
this.handleTiersChange = this.handleTiersChange.bind(this);

const event = { ... props.event || {} };
const event = { ... (props.event || {}) };
event.slug = event.slug ? event.slug.replace(/.*\//, '') : '';
this.state = { event, tiers: event.tiers || [{}] };

Expand All @@ -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 });
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputTypeCreditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputTypeLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MatchingFundWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/components/OrderForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class OrderForm extends React.Component {

componentDidMount() {
this._isMounted = true;
this.componentWillReceiveProps(this.props);
this.UNSAFE_componentWillReceiveProps(this.props);
}

populatePaymentMethodTypes() {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/PaymentMethodChooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/components/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Subscriptions extends React.Component {
})
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (!this.props.LoggedInUser && nextProps.LoggedInUser) {
return this.props.refetch();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionsWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/UpdatesWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/banner-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Banner extends React.Component {
this.sendMessageToParentWindow();
}

componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this.onChange();
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/createOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5ec95ed

Please sign in to comment.