Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

fix: delegation root node bug when switching identities #280

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/containers/DelegationCreate/DelegationCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,24 @@ class DelegationCreate extends React.Component<Props, State> {
}
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,
Expand Down