Be lenient around invalid owners map (#3764)
* Be lenient around invalid owners map * Filter invalid owners before render
This commit is contained in:
parent
1213ada59c
commit
ffd8314a11
@ -14,6 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
@ -113,15 +114,16 @@ export default class Summary extends Component {
|
|||||||
|
|
||||||
renderOwners () {
|
renderOwners () {
|
||||||
const { owners } = this.props;
|
const { owners } = this.props;
|
||||||
|
const ownersValid = (owners || []).filter((owner) => owner.address && new BigNumber(owner.address).gt(0));
|
||||||
|
|
||||||
if (!owners || owners.length === 0) {
|
if (!ownersValid || ownersValid.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.owners }>
|
<div className={ styles.owners }>
|
||||||
{
|
{
|
||||||
owners.map((owner) => (
|
ownersValid.map((owner) => (
|
||||||
<div key={ owner.address }>
|
<div key={ owner.address }>
|
||||||
<div
|
<div
|
||||||
data-tip
|
data-tip
|
||||||
|
@ -293,13 +293,17 @@ function mapStateToProps (state) {
|
|||||||
|
|
||||||
const walletsOwners = Object
|
const walletsOwners = Object
|
||||||
.keys(walletsInfo)
|
.keys(walletsInfo)
|
||||||
.map((wallet) => ({
|
.map((wallet) => {
|
||||||
owners: walletsInfo[wallet].owners.map((owner) => ({
|
const owners = walletsInfo[wallet].owners || [];
|
||||||
address: owner,
|
|
||||||
name: accountsInfo[owner] && accountsInfo[owner].name || owner
|
return {
|
||||||
})),
|
owners: owners.map((owner) => ({
|
||||||
address: wallet
|
address: owner,
|
||||||
}))
|
name: accountsInfo[owner] && accountsInfo[owner].name || owner
|
||||||
|
})),
|
||||||
|
address: wallet
|
||||||
|
};
|
||||||
|
})
|
||||||
.reduce((walletsOwners, wallet) => {
|
.reduce((walletsOwners, wallet) => {
|
||||||
walletsOwners[wallet.address] = wallet.owners;
|
walletsOwners[wallet.address] = wallet.owners;
|
||||||
return walletsOwners;
|
return walletsOwners;
|
||||||
|
Loading…
Reference in New Issue
Block a user