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

Rename React unsafe lifecycles methods #419

Merged
merged 1 commit into from
May 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/CreateCollectiveForm.js
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion src/components/EditCollectiveForm.js
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion src/components/EditEventForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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