Browse Source
fix(wallet): determine currency before display
Ensure that the wallet currency has been determined prior to displaying
the wallet components.
renovate/lint-staged-8.x
Tom Kirkpatrick
6 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
4 changed files with
23 additions and
5 deletions
-
app/components/Activity/Activity.js
-
app/components/Contacts/Network/Network.js
-
app/components/Wallet/Wallet.js
-
app/containers/App.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) |
|
|
|
|
|
@ -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) |
|
|
|
|
|
@ -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 |
|
|
|
} |
|
|
|
|
|
@ -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, |
|
|
|
|
|
|
|