diff --git a/app/components/Activity/Activity.js b/app/components/Activity/Activity.js index 0ba20558..027b0254 100644 --- a/app/components/Activity/Activity.js +++ b/app/components/Activity/Activity.js @@ -26,7 +26,7 @@ class Activity extends Component { } } - componentWillMount() { + componentDidMount() { const { fetchPayments, fetchInvoices, @@ -42,12 +42,22 @@ class Activity extends Component { fetchChannels() // HACK: wait 10 seconds and fetch channels again, allowing the node to establish connections with the remote party - setTimeout(() => fetchChannels(), 10000) + const timer = setTimeout(() => fetchChannels(), 10000) + this.setState({ timer }) + } + + componentWillUnmount() { + const { timer } = this.state + clearInterval(timer) } renderActivity(activity) { const { ticker, currentTicker, showActivityModal, network, currencyName } = this.props + if (!currencyName) { + return null + } + if (Object.prototype.hasOwnProperty.call(activity, 'block_hash')) { // activity is an on-chain tx return ( @@ -265,7 +275,7 @@ Activity.propTypes = { balance: PropTypes.object.isRequired, walletProps: PropTypes.object.isRequired, - currencyName: PropTypes.string.isRequired + currencyName: PropTypes.string } export default injectIntl(Activity) diff --git a/app/components/Contacts/Network/Network.js b/app/components/Contacts/Network/Network.js index eba1db29..edf08c50 100644 --- a/app/components/Contacts/Network/Network.js +++ b/app/components/Contacts/Network/Network.js @@ -65,6 +65,10 @@ class Network extends Component { intl } = this.props + if (!currencyName) { + return null + } + const refreshClicked = () => { // turn the spinner on this.setState({ refreshing: true }) @@ -406,7 +410,7 @@ Network.propTypes = { setSelectedChannel: PropTypes.func.isRequired, closeChannel: PropTypes.func.isRequired, - currencyName: PropTypes.string.isRequired + currencyName: PropTypes.string } export default injectIntl(Network) diff --git a/app/components/Wallet/Wallet.js b/app/components/Wallet/Wallet.js index 2be5890b..d8dbad8c 100644 --- a/app/components/Wallet/Wallet.js +++ b/app/components/Wallet/Wallet.js @@ -33,6 +33,10 @@ const Wallet = ({ paymentTimeout, theme }) => { + if (!ticker.currency) { + return null + } + const fiatAmount = btc.satoshisToFiat( parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10), currentTicker[ticker.fiatTicker] @@ -175,7 +179,6 @@ Wallet.propTypes = { successTransactionScreen: PropTypes.object.isRequired, settingsProps: PropTypes.object.isRequired, currencyFilters: PropTypes.array.isRequired, - currencyName: PropTypes.string.isRequired, paymentTimeout: PropTypes.number.isRequired, setCurrency: PropTypes.func.isRequired } diff --git a/app/containers/App.js b/app/containers/App.js index 3bf5be5b..0604478a 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -102,6 +102,7 @@ const mapStateToProps = state => ({ isLoading: infoSelectors.infoLoading(state) || tickerSelectors.tickerLoading(state) || + !tickerSelectors.currencyName(state) || state.balance.channelBalance === null || state.balance.walletBalance === null,