From 8c7d89f22bedb670051b5010e1e559dfa576ecc8 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Thu, 10 May 2018 22:34:27 -0400 Subject: [PATCH] Mark depreciated react lifecycles as unsafe (#1733) --- common/components/BalanceSidebar/EquivalentValues.tsx | 2 +- common/components/BalanceSidebar/TokenBalances/Balances.tsx | 2 +- common/components/CurrentCustomMessage.tsx | 2 +- common/components/GenerateKeystoreModal/index.tsx | 2 +- common/components/SendButtonFactory/OnlineSend.tsx | 2 +- common/components/SubTabs/index.tsx | 2 +- common/components/TXMetaDataPanel/TXMetaDataPanel.tsx | 2 +- common/components/TXMetaDataPanel/components/SimpleGas.tsx | 2 +- common/components/TogglablePassword.tsx | 2 +- common/components/TransactionStatus/TransactionStatus.tsx | 2 +- common/components/WalletDecrypt/WalletDecrypt.tsx | 2 +- .../WalletDecrypt/components/DeterministicWalletsModal.tsx | 2 +- common/components/WalletDecrypt/components/LedgerNano.tsx | 2 +- common/components/WalletDecrypt/components/Mnemonic.tsx | 2 +- common/components/WalletDecrypt/components/Trezor.tsx | 2 +- common/components/renderCbs/UnitConverter.tsx | 2 +- common/components/ui/QRCode.tsx | 4 ++-- common/components/ui/SwapDropdown.tsx | 4 ++-- .../Tabs/CheckTransaction/components/TxHashInput.tsx | 2 +- common/containers/Tabs/CheckTransaction/index.tsx | 2 +- .../components/Interact/components/InteractForm/index.tsx | 2 +- .../Tabs/SendTransaction/components/RequestPayment.tsx | 2 +- .../containers/Tabs/SendTransaction/components/WalletInfo.tsx | 2 +- common/containers/Tabs/Swap/components/CurrencySwap.tsx | 2 +- common/containers/Tabs/Swap/components/CurrentRates.tsx | 2 +- 25 files changed, 27 insertions(+), 27 deletions(-) diff --git a/common/components/BalanceSidebar/EquivalentValues.tsx b/common/components/BalanceSidebar/EquivalentValues.tsx index 431e0aba..e94ffcbb 100644 --- a/common/components/BalanceSidebar/EquivalentValues.tsx +++ b/common/components/BalanceSidebar/EquivalentValues.tsx @@ -88,7 +88,7 @@ class EquivalentValues extends React.Component { }; } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { const { balance, tokenBalances, isOffline, network } = this.props; if ( nextProps.balance !== balance || diff --git a/common/components/BalanceSidebar/TokenBalances/Balances.tsx b/common/components/BalanceSidebar/TokenBalances/Balances.tsx index d5f448da..c951f2d8 100644 --- a/common/components/BalanceSidebar/TokenBalances/Balances.tsx +++ b/common/components/BalanceSidebar/TokenBalances/Balances.tsx @@ -29,7 +29,7 @@ export default class TokenBalances extends React.PureComponent { showCustomTokenForm: false }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (nextProps.tokenBalances !== this.props.tokenBalances) { const trackedTokens = nextProps.tokenBalances.reduce((prev, t) => { prev[t.symbol] = !t.balance.isZero(); diff --git a/common/components/CurrentCustomMessage.tsx b/common/components/CurrentCustomMessage.tsx index 016c90e1..9b7b6499 100644 --- a/common/components/CurrentCustomMessage.tsx +++ b/common/components/CurrentCustomMessage.tsx @@ -29,7 +29,7 @@ class CurrentCustomMessageClass extends PureComponent { this.setAddressState(this.props); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.wallet !== nextProps.wallet) { this.setAddressState(nextProps); } diff --git a/common/components/GenerateKeystoreModal/index.tsx b/common/components/GenerateKeystoreModal/index.tsx index 7decf0ae..57a0cc28 100644 --- a/common/components/GenerateKeystoreModal/index.tsx +++ b/common/components/GenerateKeystoreModal/index.tsx @@ -41,7 +41,7 @@ export default class GenerateKeystoreModal extends React.Component } } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (nextProps.privateKey !== this.props.privateKey) { this.setState({ privateKey: nextProps.privateKey || '' }); } diff --git a/common/components/SendButtonFactory/OnlineSend.tsx b/common/components/SendButtonFactory/OnlineSend.tsx index ac44a86e..124ad123 100644 --- a/common/components/SendButtonFactory/OnlineSend.tsx +++ b/common/components/SendButtonFactory/OnlineSend.tsx @@ -64,7 +64,7 @@ class OnlineSendClass extends Component { ); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (nextProps.transactionBroadcasted && this.state.showModal) { this.closeModal(); } diff --git a/common/components/SubTabs/index.tsx b/common/components/SubTabs/index.tsx index 40ccb23b..c9819a0a 100644 --- a/common/components/SubTabs/index.tsx +++ b/common/components/SubTabs/index.tsx @@ -39,7 +39,7 @@ export default class SubTabs extends React.PureComponent { 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 // be measured and collapsed again, if needed. if (this.props.tabs !== nextProps.tabs) { diff --git a/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx b/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx index 993fc0d9..da1bfff3 100644 --- a/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx +++ b/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx @@ -76,7 +76,7 @@ class TXMetaDataPanel extends React.Component { } } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if ( (this.props.offline && !nextProps.offline) || this.props.network.unit !== nextProps.network.unit diff --git a/common/components/TXMetaDataPanel/components/SimpleGas.tsx b/common/components/TXMetaDataPanel/components/SimpleGas.tsx index e386af59..84d065d0 100644 --- a/common/components/TXMetaDataPanel/components/SimpleGas.tsx +++ b/common/components/TXMetaDataPanel/components/SimpleGas.tsx @@ -57,7 +57,7 @@ class SimpleGas extends React.Component { this.props.fetchGasEstimates(); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (!this.state.hasSetRecommendedGasPrice && nextProps.gasEstimates) { this.setState({ hasSetRecommendedGasPrice: true }); this.props.setGasPrice(nextProps.gasEstimates.fast.toString()); diff --git a/common/components/TogglablePassword.tsx b/common/components/TogglablePassword.tsx index d5871577..164d4173 100644 --- a/common/components/TogglablePassword.tsx +++ b/common/components/TogglablePassword.tsx @@ -40,7 +40,7 @@ export default class TogglablePassword extends React.PureComponent isVisible: !!this.props.isVisible }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.isVisible !== nextProps.isVisible) { this.setState({ isVisible: !!nextProps.isVisible }); } diff --git a/common/components/TransactionStatus/TransactionStatus.tsx b/common/components/TransactionStatus/TransactionStatus.tsx index 0fada1e3..13f417a5 100644 --- a/common/components/TransactionStatus/TransactionStatus.tsx +++ b/common/components/TransactionStatus/TransactionStatus.tsx @@ -31,7 +31,7 @@ class TransactionStatus extends React.Component { this.props.fetchTransactionData(this.props.txHash); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.txHash !== nextProps.txHash) { this.props.fetchTransactionData(nextProps.txHash); } diff --git a/common/components/WalletDecrypt/WalletDecrypt.tsx b/common/components/WalletDecrypt/WalletDecrypt.tsx index b9515f8c..30bd9338 100644 --- a/common/components/WalletDecrypt/WalletDecrypt.tsx +++ b/common/components/WalletDecrypt/WalletDecrypt.tsx @@ -226,7 +226,7 @@ const WalletDecrypt = withRouter( hasAcknowledgedInsecure: false }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { // Reset state when unlock is hidden / revealed if (nextProps.hidden !== this.props.hidden) { this.setState({ diff --git a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx index 80ba7135..7c810d73 100644 --- a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx +++ b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx @@ -73,7 +73,7 @@ class DeterministicWalletsModalClass extends React.PureComponent { this.getAddresses(); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { const { publicKey, chainCode, seed, dPath } = this.props; if ( nextProps.publicKey !== publicKey || diff --git a/common/components/WalletDecrypt/components/LedgerNano.tsx b/common/components/WalletDecrypt/components/LedgerNano.tsx index e4b3e222..bc46bb63 100644 --- a/common/components/WalletDecrypt/components/LedgerNano.tsx +++ b/common/components/WalletDecrypt/components/LedgerNano.tsx @@ -50,7 +50,7 @@ class LedgerNanoSDecryptClass extends PureComponent { }); }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.dPath !== nextProps.dPath && nextProps.dPath) { this.setState({ dPath: nextProps.dPath }); } diff --git a/common/components/WalletDecrypt/components/Mnemonic.tsx b/common/components/WalletDecrypt/components/Mnemonic.tsx index 0e3d30e1..9aef3aac 100644 --- a/common/components/WalletDecrypt/components/Mnemonic.tsx +++ b/common/components/WalletDecrypt/components/Mnemonic.tsx @@ -39,7 +39,7 @@ class MnemonicDecryptClass extends PureComponent { dPath: this.props.dPath }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.dPath !== nextProps.dPath) { this.setState({ dPath: nextProps.dPath }); } diff --git a/common/components/WalletDecrypt/components/Trezor.tsx b/common/components/WalletDecrypt/components/Trezor.tsx index 6bc27a81..c8c4bc27 100644 --- a/common/components/WalletDecrypt/components/Trezor.tsx +++ b/common/components/WalletDecrypt/components/Trezor.tsx @@ -41,7 +41,7 @@ class TrezorDecryptClass extends PureComponent { isLoading: false }; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.dPath !== nextProps.dPath && nextProps.dPath) { this.setState({ dPath: nextProps.dPath }); } diff --git a/common/components/renderCbs/UnitConverter.tsx b/common/components/renderCbs/UnitConverter.tsx index bd63121e..08275d2e 100644 --- a/common/components/renderCbs/UnitConverter.tsx +++ b/common/components/renderCbs/UnitConverter.tsx @@ -29,7 +29,7 @@ const initialState = { userInput: '' }; class UnitConverterClass extends Component { public state: State = initialState; - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { const { userInput } = this.state; if (this.props.decimal !== nextProps.decimal) { diff --git a/common/components/ui/QRCode.tsx b/common/components/ui/QRCode.tsx index aaf7bea3..7c233be8 100644 --- a/common/components/ui/QRCode.tsx +++ b/common/components/ui/QRCode.tsx @@ -15,12 +15,12 @@ interface State { export default class QRCode extends React.PureComponent { public state: State = {}; - public componentWillMount() { + public UNSAFE_componentWillMount() { // Start generating QR codes immediately this.generateQrCode(this.props.data); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { // Regenerate QR codes if props change if (nextProps.data !== this.props.data) { this.generateQrCode(nextProps.data); diff --git a/common/components/ui/SwapDropdown.tsx b/common/components/ui/SwapDropdown.tsx index d1f42194..2f8541c7 100644 --- a/common/components/ui/SwapDropdown.tsx +++ b/common/components/ui/SwapDropdown.tsx @@ -34,7 +34,7 @@ class SwapDropdown extends PureComponent { public dropdown: HTMLDivElement | null; - public componentWillMount() { + public UNSAFE_componentWillMount() { this.buildOptions(this.props.options); document.addEventListener('click', this.handleBodyClick); } @@ -43,7 +43,7 @@ class SwapDropdown extends PureComponent { document.removeEventListener('click', this.handleBodyClick); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.options !== nextProps.options) { this.buildOptions(nextProps.options); } diff --git a/common/containers/Tabs/CheckTransaction/components/TxHashInput.tsx b/common/containers/Tabs/CheckTransaction/components/TxHashInput.tsx index d3c401c4..04cfde6c 100644 --- a/common/containers/Tabs/CheckTransaction/components/TxHashInput.tsx +++ b/common/containers/Tabs/CheckTransaction/components/TxHashInput.tsx @@ -33,7 +33,7 @@ class TxHashInput extends React.Component { this.state = { hash: props.hash || '' }; } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.hash !== nextProps.hash && nextProps.hash) { this.setState({ hash: nextProps.hash }); } diff --git a/common/containers/Tabs/CheckTransaction/index.tsx b/common/containers/Tabs/CheckTransaction/index.tsx index 9001a5f9..8210a7f9 100644 --- a/common/containers/Tabs/CheckTransaction/index.tsx +++ b/common/containers/Tabs/CheckTransaction/index.tsx @@ -34,7 +34,7 @@ class CheckTransaction extends React.Component { } } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { const { network } = this.props; if (network.chainId !== nextProps.network.chainId) { this.setState({ hash: '' }); diff --git a/common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx b/common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx index 74b513b7..40427590 100644 --- a/common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx +++ b/common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx @@ -63,7 +63,7 @@ class InteractForm extends Component { }; } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { const prevProps = this.props; if (nextProps.currentTo.raw !== prevProps.currentTo.raw) { nextProps.resetState(); diff --git a/common/containers/Tabs/SendTransaction/components/RequestPayment.tsx b/common/containers/Tabs/SendTransaction/components/RequestPayment.tsx index fe615cdf..f12700b4 100644 --- a/common/containers/Tabs/SendTransaction/components/RequestPayment.tsx +++ b/common/containers/Tabs/SendTransaction/components/RequestPayment.tsx @@ -68,7 +68,7 @@ class RequestPayment extends React.Component { this.props.resetTransactionRequested(); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (nextProps.wallet && this.props.wallet !== nextProps.wallet) { this.setWalletAsyncState(nextProps.wallet); } diff --git a/common/containers/Tabs/SendTransaction/components/WalletInfo.tsx b/common/containers/Tabs/SendTransaction/components/WalletInfo.tsx index b3c12804..00e79251 100644 --- a/common/containers/Tabs/SendTransaction/components/WalletInfo.tsx +++ b/common/containers/Tabs/SendTransaction/components/WalletInfo.tsx @@ -30,7 +30,7 @@ export default class WalletInfo extends React.PureComponent { this.setStateFromWallet(this.props.wallet); } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.wallet !== nextProps.wallet) { this.setStateFromWallet(nextProps.wallet); } diff --git a/common/containers/Tabs/Swap/components/CurrencySwap.tsx b/common/containers/Tabs/Swap/components/CurrencySwap.tsx index e177fef9..ede70043 100644 --- a/common/containers/Tabs/Swap/components/CurrencySwap.tsx +++ b/common/containers/Tabs/Swap/components/CurrencySwap.tsx @@ -117,7 +117,7 @@ export default class CurrencySwap extends PureComponent { } } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (nextProps.options !== this.props.options) { this.setState({ options: Object.values(nextProps.options.byId) }); } diff --git a/common/containers/Tabs/Swap/components/CurrentRates.tsx b/common/containers/Tabs/Swap/components/CurrentRates.tsx index 2cdf218f..b56e344a 100644 --- a/common/containers/Tabs/Swap/components/CurrentRates.tsx +++ b/common/containers/Tabs/Swap/components/CurrentRates.tsx @@ -49,7 +49,7 @@ class CurrentRates extends PureComponent { } } - public componentWillReceiveProps(nextProps: Props) { + public UNSAFE_componentWillReceiveProps(nextProps: Props) { if (this.props.isOffline && !nextProps.isOffline) { this.loadRates(); }