don't loop over transactions if we don't have to
This commit is contained in:
parent
af3a367875
commit
e7e58b3e08
1 changed files with 4 additions and 6 deletions
|
@ -48,11 +48,6 @@ class TransactionList extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
filterTransaction(transaction: Transaction) {
|
filterTransaction(transaction: Transaction) {
|
||||||
// The shorter "recent transactions" list shouldn't be filtered
|
|
||||||
if (this.props.slim) {
|
|
||||||
return transaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
this.props.filterSetting === TRANSACTIONS.ALL || this.props.filterSetting === transaction.type
|
this.props.filterSetting === TRANSACTIONS.ALL || this.props.filterSetting === transaction.type
|
||||||
);
|
);
|
||||||
|
@ -71,7 +66,10 @@ class TransactionList extends React.PureComponent<Props> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { emptyMessage, rewards, transactions, slim, filterSetting } = this.props;
|
const { emptyMessage, rewards, transactions, slim, filterSetting } = this.props;
|
||||||
const transactionList = transactions.filter(this.filterTransaction);
|
|
||||||
|
// The shorter "recent transactions" list shouldn't be filtered
|
||||||
|
const transactionList = slim ? transactions : transactions.filter(this.filterTransaction);
|
||||||
|
|
||||||
// Flow offers little support for Object.values() typing.
|
// Flow offers little support for Object.values() typing.
|
||||||
// https://github.com/facebook/flow/issues/2221
|
// https://github.com/facebook/flow/issues/2221
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
|
|
Loading…
Add table
Reference in a new issue