From 8a56a17cbcc313e3b9bbedc530fc7abb0ec12680 Mon Sep 17 00:00:00 2001 From: Sunny Gleason Date: Tue, 15 Oct 2019 14:08:29 -0400 Subject: [PATCH] feat: handle mapmarker errors, empty leader tooltip --- .../NetworkOverview/StatCards/index.jsx | 2 +- src/v2/stores/nodes.js | 29 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/v2/components/Dashboard/NetworkOverview/StatCards/index.jsx b/src/v2/components/Dashboard/NetworkOverview/StatCards/index.jsx index 801b2238..8bb65d4d 100644 --- a/src/v2/components/Dashboard/NetworkOverview/StatCards/index.jsx +++ b/src/v2/components/Dashboard/NetworkOverview/StatCards/index.jsx @@ -48,7 +48,7 @@ const StatCards = () => { ({ - pubkey, - gossip, - coordinates, - name: (identity && identity.name) || identity.pubkey, - avatarUrl: (identity && identity.avatarUrl) || '', - })), - filter({what: 'Validator'}), - )(this.network); + if (!this.network || !this.network.length) { + return []; + } + + try { + return compose( + map(({nodePubkey: pubkey, tpu: gossip, coordinates, identity}) => ({ + pubkey, + gossip, + coordinates, + name: (identity && identity.name) || identity.pubkey, + avatarUrl: (identity && identity.avatarUrl) || '', + })), + filter({what: 'Validator'}), + )(this.network); + } catch (e) { + console.error('mapMarkers()', e); + return []; + } } get validators() {