From 522fc83d68ffde71dc742a069b3bc6f72c0e0d97 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Wed, 10 Apr 2019 22:21:44 +0200 Subject: [PATCH] fix(launchpad): fallback wallet name incase host unknown --- renderer/components/Util/WalletName.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/renderer/components/Util/WalletName.js b/renderer/components/Util/WalletName.js index 10ba89fc525..1adce0f4b70 100644 --- a/renderer/components/Util/WalletName.js +++ b/renderer/components/Util/WalletName.js @@ -4,11 +4,18 @@ const WalletName = ({ wallet }) => { if (!wallet) { return null } + const { name, host, type, id } = wallet - if (wallet.type === 'local') { - return wallet.name || `Wallet #${wallet.id}` + // For local wallets, display the wallet name if set. + // Otherwise fallback to the wallet id. + if (type === 'local') { + return name || `Wallet #${id}` } - return wallet.name || wallet.host.split(':')[0] + + // For remote wallets, use the wallet name if set. + // Otherwise use the hostname. + // If neither are set, provide a fallback value. + return name || (host && host.split(':')[0]) || '[unnamed]' } WalletName.propTypes = {