From 567b5634ca39eb4f6c72b23d3a48e2ba59c0210a Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 5 Jun 2020 16:14:26 -0700 Subject: [PATCH] cleanup; update metadata as needed --- .../permissions-connect.component.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/app/pages/permissions-connect/permissions-connect.component.js b/ui/app/pages/permissions-connect/permissions-connect.component.js index 70a50622b..f9dc41f64 100644 --- a/ui/app/pages/permissions-connect/permissions-connect.component.js +++ b/ui/app/pages/permissions-connect/permissions-connect.component.js @@ -36,9 +36,6 @@ export default class PermissionConnect extends Component { confirmPermissionPath: PropTypes.string.isRequired, page: PropTypes.string.isRequired, targetDomainMetadata: PropTypes.object, - location: PropTypes.shape({ - pathname: PropTypes.string, - }).isRequired, } static defaultProps = { @@ -59,7 +56,7 @@ export default class PermissionConnect extends Component { : new Set(), permissionsApproved: null, origin: this.props.origin, - targetDomainMetadata: this.props.targetDomainMetadata, + targetDomainMetadata: this.props.targetDomainMetadata || {}, } beforeUnload = () => { @@ -105,8 +102,14 @@ export default class PermissionConnect extends Component { } componentDidUpdate (prevProps) { - const { permissionsRequest, lastConnectedInfo } = this.props - const { redirecting, origin } = this.state + const { permissionsRequest, lastConnectedInfo, targetDomainMetadata } = this.props + const { redirecting, origin, targetDomainMetadata: savedMetadata } = this.state + + if (savedMetadata.name !== targetDomainMetadata?.name) { + this.setState({ + targetDomainMetadata, + }) + } if (!permissionsRequest && prevProps.permissionsRequest && !redirecting) {