diff --git a/app/components/pages/Market.jsx b/app/components/pages/Market.jsx index 41cdac52f2..0cf12ee685 100644 --- a/app/components/pages/Market.jsx +++ b/app/components/pages/Market.jsx @@ -211,7 +211,7 @@ class Market extends React.Component { }, {}) } - let account = this.props.account + let account = this.props.account ? this.props.account.toJS() : null; let open_orders = this.props.open_orders; let orderbook = aggOrders(normalizeOrders(this.props.orderbook)); diff --git a/app/components/pages/Witnesses.jsx b/app/components/pages/Witnesses.jsx index 3c910da090..75719b6652 100644 --- a/app/components/pages/Witnesses.jsx +++ b/app/components/pages/Witnesses.jsx @@ -5,7 +5,7 @@ import links from 'app/utils/Links' import Icon from 'app/components/elements/Icon'; import transaction from 'app/redux/Transaction' import ByteBuffer from 'bytebuffer' -import {Set} from 'immutable' +import {Set, is} from 'immutable' import { translate } from 'app/Translator'; const Long = ByteBuffer.Long @@ -16,7 +16,7 @@ class Witnesses extends React.Component { // HTML properties // Redux connect properties - global: object.isRequired, + witnesses: object.isRequired, accountWitnessVote: func.isRequired, username: string, witness_votes: object, @@ -36,20 +36,20 @@ class Witnesses extends React.Component { } } + shouldComponentUpdate(np, ns) { + return ( + !is(np.witness_votes, this.props.witness_votes) || + np.witnesses !== this.props.witnesses || + np.username !== this.props.username || + ns.customUsername !== this.state.customUsername + ); + } + render() { - const {props: {global, witness_votes}, state: {customUsername}, accountWitnessVote, onWitnessChange} = this - const sorted_witnesses = global.getIn(['witnesses']) + const {props: {witness_votes}, state: {customUsername}, accountWitnessVote, onWitnessChange} = this + const sorted_witnesses = this.props.witnesses .sort((a, b) => Long.fromString(String(b.get('votes'))).subtract(Long.fromString(String(a.get('votes'))).toString())); - const header = -