Fix UI crash when domain metadata is missing (#10180)

The "Confirm public encryption key" page will now no longer crash when
the domain metadata is missing.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 0dfdd44ae7
commit 9e03066157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      ui/app/pages/confirm-encryption-public-key/confirm-encryption-public-key.component.js

@ -158,23 +158,24 @@ export default class ConfirmEncryptionPublicKey extends Component {
const { domainMetadata, txData } = this.props const { domainMetadata, txData } = this.props
const { t } = this.context const { t } = this.context
const origin = domainMetadata[txData.origin] const originMetadata = domainMetadata[txData.origin]
const notice = t('encryptionPublicKeyNotice', [origin.name]) const notice = t('encryptionPublicKeyNotice', [txData.origin])
const name = originMetadata?.name || txData.origin
return ( return (
<div className="request-encryption-public-key__body"> <div className="request-encryption-public-key__body">
{this.renderAccountInfo()} {this.renderAccountInfo()}
<div className="request-encryption-public-key__visual"> <div className="request-encryption-public-key__visual">
<section> <section>
{origin.icon ? ( {originMetadata?.icon ? (
<img <img
className="request-encryption-public-key__visual-identicon" className="request-encryption-public-key__visual-identicon"
src={origin.icon} src={originMetadata.icon}
alt="" alt=""
/> />
) : ( ) : (
<i className="request-encryption-public-key__visual-identicon--default"> <i className="request-encryption-public-key__visual-identicon--default">
{origin.name.charAt(0).toUpperCase()} {name.charAt(0).toUpperCase()}
</i> </i>
)} )}
<div className="request-encryption-public-key__notice"> <div className="request-encryption-public-key__notice">

Loading…
Cancel
Save