Mark depreciated react lifecycles as unsafe (#1733)
This commit is contained in:
parent
a71c5daec0
commit
8c7d89f22b
|
@ -88,7 +88,7 @@ class EquivalentValues extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
const { balance, tokenBalances, isOffline, network } = this.props;
|
const { balance, tokenBalances, isOffline, network } = this.props;
|
||||||
if (
|
if (
|
||||||
nextProps.balance !== balance ||
|
nextProps.balance !== balance ||
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default class TokenBalances extends React.PureComponent<Props, State> {
|
||||||
showCustomTokenForm: false
|
showCustomTokenForm: false
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.tokenBalances !== this.props.tokenBalances) {
|
if (nextProps.tokenBalances !== this.props.tokenBalances) {
|
||||||
const trackedTokens = nextProps.tokenBalances.reduce<TrackedTokens>((prev, t) => {
|
const trackedTokens = nextProps.tokenBalances.reduce<TrackedTokens>((prev, t) => {
|
||||||
prev[t.symbol] = !t.balance.isZero();
|
prev[t.symbol] = !t.balance.isZero();
|
||||||
|
|
|
@ -29,7 +29,7 @@ class CurrentCustomMessageClass extends PureComponent<Props, State> {
|
||||||
this.setAddressState(this.props);
|
this.setAddressState(this.props);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.wallet !== nextProps.wallet) {
|
if (this.props.wallet !== nextProps.wallet) {
|
||||||
this.setAddressState(nextProps);
|
this.setAddressState(nextProps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default class GenerateKeystoreModal extends React.Component<Props, State>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.privateKey !== this.props.privateKey) {
|
if (nextProps.privateKey !== this.props.privateKey) {
|
||||||
this.setState({ privateKey: nextProps.privateKey || '' });
|
this.setState({ privateKey: nextProps.privateKey || '' });
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class OnlineSendClass extends Component<Props, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.transactionBroadcasted && this.state.showModal) {
|
if (nextProps.transactionBroadcasted && this.state.showModal) {
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default class SubTabs extends React.PureComponent<Props, State> {
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
// When new tabs come in, we'll need to uncollapse so that they can
|
// When new tabs come in, we'll need to uncollapse so that they can
|
||||||
// be measured and collapsed again, if needed.
|
// be measured and collapsed again, if needed.
|
||||||
if (this.props.tabs !== nextProps.tabs) {
|
if (this.props.tabs !== nextProps.tabs) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ class TXMetaDataPanel extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (
|
if (
|
||||||
(this.props.offline && !nextProps.offline) ||
|
(this.props.offline && !nextProps.offline) ||
|
||||||
this.props.network.unit !== nextProps.network.unit
|
this.props.network.unit !== nextProps.network.unit
|
||||||
|
|
|
@ -57,7 +57,7 @@ class SimpleGas extends React.Component<Props> {
|
||||||
this.props.fetchGasEstimates();
|
this.props.fetchGasEstimates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (!this.state.hasSetRecommendedGasPrice && nextProps.gasEstimates) {
|
if (!this.state.hasSetRecommendedGasPrice && nextProps.gasEstimates) {
|
||||||
this.setState({ hasSetRecommendedGasPrice: true });
|
this.setState({ hasSetRecommendedGasPrice: true });
|
||||||
this.props.setGasPrice(nextProps.gasEstimates.fast.toString());
|
this.props.setGasPrice(nextProps.gasEstimates.fast.toString());
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default class TogglablePassword extends React.PureComponent<Props, State>
|
||||||
isVisible: !!this.props.isVisible
|
isVisible: !!this.props.isVisible
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.isVisible !== nextProps.isVisible) {
|
if (this.props.isVisible !== nextProps.isVisible) {
|
||||||
this.setState({ isVisible: !!nextProps.isVisible });
|
this.setState({ isVisible: !!nextProps.isVisible });
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TransactionStatus extends React.Component<Props> {
|
||||||
this.props.fetchTransactionData(this.props.txHash);
|
this.props.fetchTransactionData(this.props.txHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.txHash !== nextProps.txHash) {
|
if (this.props.txHash !== nextProps.txHash) {
|
||||||
this.props.fetchTransactionData(nextProps.txHash);
|
this.props.fetchTransactionData(nextProps.txHash);
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ const WalletDecrypt = withRouter<Props>(
|
||||||
hasAcknowledgedInsecure: false
|
hasAcknowledgedInsecure: false
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
// Reset state when unlock is hidden / revealed
|
// Reset state when unlock is hidden / revealed
|
||||||
if (nextProps.hidden !== this.props.hidden) {
|
if (nextProps.hidden !== this.props.hidden) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -73,7 +73,7 @@ class DeterministicWalletsModalClass extends React.PureComponent<Props, State> {
|
||||||
this.getAddresses();
|
this.getAddresses();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
const { publicKey, chainCode, seed, dPath } = this.props;
|
const { publicKey, chainCode, seed, dPath } = this.props;
|
||||||
if (
|
if (
|
||||||
nextProps.publicKey !== publicKey ||
|
nextProps.publicKey !== publicKey ||
|
||||||
|
|
|
@ -50,7 +50,7 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.dPath !== nextProps.dPath && nextProps.dPath) {
|
if (this.props.dPath !== nextProps.dPath && nextProps.dPath) {
|
||||||
this.setState({ dPath: nextProps.dPath });
|
this.setState({ dPath: nextProps.dPath });
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class MnemonicDecryptClass extends PureComponent<Props, State> {
|
||||||
dPath: this.props.dPath
|
dPath: this.props.dPath
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.dPath !== nextProps.dPath) {
|
if (this.props.dPath !== nextProps.dPath) {
|
||||||
this.setState({ dPath: nextProps.dPath });
|
this.setState({ dPath: nextProps.dPath });
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TrezorDecryptClass extends PureComponent<Props, State> {
|
||||||
isLoading: false
|
isLoading: false
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.dPath !== nextProps.dPath && nextProps.dPath) {
|
if (this.props.dPath !== nextProps.dPath && nextProps.dPath) {
|
||||||
this.setState({ dPath: nextProps.dPath });
|
this.setState({ dPath: nextProps.dPath });
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ const initialState = { userInput: '' };
|
||||||
class UnitConverterClass extends Component<Props, State> {
|
class UnitConverterClass extends Component<Props, State> {
|
||||||
public state: State = initialState;
|
public state: State = initialState;
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
const { userInput } = this.state;
|
const { userInput } = this.state;
|
||||||
|
|
||||||
if (this.props.decimal !== nextProps.decimal) {
|
if (this.props.decimal !== nextProps.decimal) {
|
||||||
|
|
|
@ -15,12 +15,12 @@ interface State {
|
||||||
|
|
||||||
export default class QRCode extends React.PureComponent<Props, State> {
|
export default class QRCode extends React.PureComponent<Props, State> {
|
||||||
public state: State = {};
|
public state: State = {};
|
||||||
public componentWillMount() {
|
public UNSAFE_componentWillMount() {
|
||||||
// Start generating QR codes immediately
|
// Start generating QR codes immediately
|
||||||
this.generateQrCode(this.props.data);
|
this.generateQrCode(this.props.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
// Regenerate QR codes if props change
|
// Regenerate QR codes if props change
|
||||||
if (nextProps.data !== this.props.data) {
|
if (nextProps.data !== this.props.data) {
|
||||||
this.generateQrCode(nextProps.data);
|
this.generateQrCode(nextProps.data);
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SwapDropdown extends PureComponent<Props, State> {
|
||||||
|
|
||||||
public dropdown: HTMLDivElement | null;
|
public dropdown: HTMLDivElement | null;
|
||||||
|
|
||||||
public componentWillMount() {
|
public UNSAFE_componentWillMount() {
|
||||||
this.buildOptions(this.props.options);
|
this.buildOptions(this.props.options);
|
||||||
document.addEventListener('click', this.handleBodyClick);
|
document.addEventListener('click', this.handleBodyClick);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class SwapDropdown extends PureComponent<Props, State> {
|
||||||
document.removeEventListener('click', this.handleBodyClick);
|
document.removeEventListener('click', this.handleBodyClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.options !== nextProps.options) {
|
if (this.props.options !== nextProps.options) {
|
||||||
this.buildOptions(nextProps.options);
|
this.buildOptions(nextProps.options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class TxHashInput extends React.Component<Props, State> {
|
||||||
this.state = { hash: props.hash || '' };
|
this.state = { hash: props.hash || '' };
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.hash !== nextProps.hash && nextProps.hash) {
|
if (this.props.hash !== nextProps.hash && nextProps.hash) {
|
||||||
this.setState({ hash: nextProps.hash });
|
this.setState({ hash: nextProps.hash });
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class CheckTransaction extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
const { network } = this.props;
|
const { network } = this.props;
|
||||||
if (network.chainId !== nextProps.network.chainId) {
|
if (network.chainId !== nextProps.network.chainId) {
|
||||||
this.setState({ hash: '' });
|
this.setState({ hash: '' });
|
||||||
|
|
|
@ -63,7 +63,7 @@ class InteractForm extends Component<Props, State> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
const prevProps = this.props;
|
const prevProps = this.props;
|
||||||
if (nextProps.currentTo.raw !== prevProps.currentTo.raw) {
|
if (nextProps.currentTo.raw !== prevProps.currentTo.raw) {
|
||||||
nextProps.resetState();
|
nextProps.resetState();
|
||||||
|
|
|
@ -68,7 +68,7 @@ class RequestPayment extends React.Component<Props, {}> {
|
||||||
this.props.resetTransactionRequested();
|
this.props.resetTransactionRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.wallet && this.props.wallet !== nextProps.wallet) {
|
if (nextProps.wallet && this.props.wallet !== nextProps.wallet) {
|
||||||
this.setWalletAsyncState(nextProps.wallet);
|
this.setWalletAsyncState(nextProps.wallet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default class WalletInfo extends React.PureComponent<Props, State> {
|
||||||
this.setStateFromWallet(this.props.wallet);
|
this.setStateFromWallet(this.props.wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.wallet !== nextProps.wallet) {
|
if (this.props.wallet !== nextProps.wallet) {
|
||||||
this.setStateFromWallet(nextProps.wallet);
|
this.setStateFromWallet(nextProps.wallet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ export default class CurrencySwap extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (nextProps.options !== this.props.options) {
|
if (nextProps.options !== this.props.options) {
|
||||||
this.setState({ options: Object.values(nextProps.options.byId) });
|
this.setState({ options: Object.values(nextProps.options.byId) });
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class CurrentRates extends PureComponent<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps(nextProps: Props) {
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||||
if (this.props.isOffline && !nextProps.isOffline) {
|
if (this.props.isOffline && !nextProps.isOffline) {
|
||||||
this.loadRates();
|
this.loadRates();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue