diff --git a/src/containers/DelegationCreate/DelegationCreate.tsx b/src/containers/DelegationCreate/DelegationCreate.tsx index 6b2ac9d0..0e59b77b 100644 --- a/src/containers/DelegationCreate/DelegationCreate.tsx +++ b/src/containers/DelegationCreate/DelegationCreate.tsx @@ -45,13 +45,24 @@ class DelegationCreate extends React.Component { } this.handleNameChange = this.handleNameChange.bind(this) this.submit = this.submit.bind(this) + this.setDelegation = this.setDelegation.bind(this) } public componentDidMount(): void { + this.setDelegation() + } + + public componentDidUpdate(prevProps: Props): void { + const { selectedIdentity } = this.props + if (selectedIdentity !== prevProps.selectedIdentity) { + this.setDelegation() + } + } + + public setDelegation(): void { const { match, selectedIdentity } = this.props const { cTypeHash } = match.params const { alias } = this.state - if (selectedIdentity) { this.setState({ alias,