From ede5afa6e0faa5ac4917a41d31ed93822410f1b7 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Thu, 2 Aug 2018 14:49:38 +0100 Subject: [PATCH] Feedback PR --- embark-ui/src/containers/BlocksContainer.js | 7 +------ embark-ui/src/reducers/blocksReducer.js | 2 +- lib/modules/blockchain_connector/index.js | 8 +++++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/embark-ui/src/containers/BlocksContainer.js b/embark-ui/src/containers/BlocksContainer.js index 3dbc36d11..b2a5cb17a 100644 --- a/embark-ui/src/containers/BlocksContainer.js +++ b/embark-ui/src/containers/BlocksContainer.js @@ -9,11 +9,6 @@ import LoadMore from '../components/LoadMore'; class BlocksContainer extends Component { - constructor(props) { - super(props); - this.loadMore = this.loadMore.bind(this); - } - componentDidMount() { if (!this.props.blocks.data) { this.props.fetchBlocks(); @@ -46,7 +41,7 @@ class BlocksContainer extends Component { return ( - {(this.loadMoreFrom() >= 0) ? : } + {(this.loadMoreFrom() >= 0) ? this.loadMore()} /> : } ); } diff --git a/embark-ui/src/reducers/blocksReducer.js b/embark-ui/src/reducers/blocksReducer.js index 7a6674fc2..5ffac690b 100644 --- a/embark-ui/src/reducers/blocksReducer.js +++ b/embark-ui/src/reducers/blocksReducer.js @@ -3,7 +3,7 @@ import {RECEIVE_BLOCKS, RECEIVE_BLOCKS_ERROR} from "../actions"; export default function blocks(state = {}, action) { switch (action.type) { case RECEIVE_BLOCKS: - return Object.assign({}, state, {data: [...state.data || [], ...action.blocks.data]}); + return {...state, data: [...state.data || [], ...action.blocks.data]}; case RECEIVE_BLOCKS_ERROR: return Object.assign({}, state, {error: true}); default: diff --git a/lib/modules/blockchain_connector/index.js b/lib/modules/blockchain_connector/index.js index 0b61ee518..1c287ca91 100644 --- a/lib/modules/blockchain_connector/index.js +++ b/lib/modules/blockchain_connector/index.js @@ -301,6 +301,7 @@ class BlockchainConnector { function(callback) { self.getTransactionCount(address, (err, count) => { if (err) { + self.logger.error(err); result.transactionCount = 0; } else { result.transactionCount = count; @@ -311,6 +312,7 @@ class BlockchainConnector { function(callback) { self.getBalance(address, (err, balance) => { if (err) { + self.logger.error(err); result.balance = 0; } else { result.balance = self.web3.utils.fromWei(balance); @@ -342,6 +344,7 @@ class BlockchainConnector { } self.getBlockNumber((err, blockNumber) => { if (err) { + self.logger.error(err); from = 0; } else { from = blockNumber; @@ -353,14 +356,13 @@ class BlockchainConnector { async.times(limit, function(n, next) { self.web3.eth.getBlock(from - n, function(err, block) { if (err){ + self.logger.error(err); return next(); } results.push(block); next(); }); - }, function() { - callback(); - }); + }, callback); } ], function () { res.send(results);