Browse Source

Merge pull request #945 from mrfelton/fix/suggested-nodes

fix(wallet): load suggested nodes on Root mount
renovate/babel-plugin-styled-components-1.x
JimmyMow 6 years ago
committed by GitHub
parent
commit
50f59b5d26
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      app/components/App/App.js
  2. 4
      app/components/Contacts/Network/Network.js
  3. 5
      app/containers/Root.js

19
app/components/App/App.js

@ -26,22 +26,15 @@ class App extends React.Component {
receiveModalProps: PropTypes.object, receiveModalProps: PropTypes.object,
channelFormProps: PropTypes.object, channelFormProps: PropTypes.object,
fetchInfo: PropTypes.func.isRequired, fetchInfo: PropTypes.func.isRequired,
fetchDescribeNetwork: PropTypes.func.isRequired, fetchDescribeNetwork: PropTypes.func.isRequired
fetchSuggestedNodes: PropTypes.func.isRequired
} }
componentDidMount() { componentDidMount() {
const { currentTicker, fetchInfo, fetchSuggestedNodes, fetchDescribeNetwork } = this.props const { fetchInfo, fetchDescribeNetwork } = this.props
// fetch node info.
// If we don't yet have any ticker information then it must be our first time mounting this component. fetchInfo()
if (!currentTicker) { // fetch LN network from nodes POV.
// fetch node info. fetchDescribeNetwork()
fetchInfo()
// fetch suggested nodes list from zap.jackmallers.com/suggested-peers.
fetchSuggestedNodes()
// fetch LN network from nodes POV.
fetchDescribeNetwork()
}
} }
render() { render() {

4
app/components/Contacts/Network/Network.js

@ -369,7 +369,9 @@ class Network extends Component {
})} })}
</ul> </ul>
</div> </div>
{(loadingChannelPubkeys.length || pending_open_channels.length || channels.length) && ( {Boolean(
loadingChannelPubkeys.length || pending_open_channels.length || channels.length
) && (
<footer className={styles.search}> <footer className={styles.search}>
<label htmlFor="search" className={`${styles.label} ${styles.input}`}> <label htmlFor="search" className={`${styles.label} ${styles.input}`}>
<Search /> <Search />

5
app/containers/Root.js

@ -10,6 +10,7 @@ import { loadingSelectors, setLoading, setMounted } from 'reducers/loading'
import { initCurrency, initLocale } from 'reducers/locale' import { initCurrency, initLocale } from 'reducers/locale'
import { initTheme, themeSelectors } from 'reducers/theme' import { initTheme, themeSelectors } from 'reducers/theme'
import { fetchTicker, tickerSelectors } from 'reducers/ticker' import { fetchTicker, tickerSelectors } from 'reducers/ticker'
import { fetchSuggestedNodes } from 'reducers/channels'
import { Page, Titlebar, GlobalStyle } from 'components/UI' import { Page, Titlebar, GlobalStyle } from 'components/UI'
import GlobalError from 'components/GlobalError' import GlobalError from 'components/GlobalError'
@ -33,6 +34,7 @@ class Root extends React.Component {
currentTicker: PropTypes.object, currentTicker: PropTypes.object,
theme: PropTypes.object, theme: PropTypes.object,
error: PropTypes.string, error: PropTypes.string,
fetchSuggestedNodes: PropTypes.func.isRequired,
fetchTicker: PropTypes.func.isRequired, fetchTicker: PropTypes.func.isRequired,
history: PropTypes.object.isRequired, history: PropTypes.object.isRequired,
initLocale: PropTypes.func.isRequired, initLocale: PropTypes.func.isRequired,
@ -60,6 +62,7 @@ class Root extends React.Component {
componentDidMount() { componentDidMount() {
const { const {
currentTicker, currentTicker,
fetchSuggestedNodes,
fetchTicker, fetchTicker,
initLocale, initLocale,
initCurrency, initCurrency,
@ -78,6 +81,7 @@ class Root extends React.Component {
initLocale() initLocale()
initCurrency() initCurrency()
fetchTicker() fetchTicker()
fetchSuggestedNodes()
} }
// Hide the loading screen after a set time. // Hide the loading screen after a set time.
@ -135,6 +139,7 @@ const mapStateToProps = state => ({
const mapDispatchToProps = { const mapDispatchToProps = {
clearError, clearError,
fetchSuggestedNodes,
fetchTicker, fetchTicker,
initCurrency, initCurrency,
initLocale, initLocale,

Loading…
Cancel
Save