Skip to content

Commit

Permalink
fix: prevent account not found error on disconnect (#2073)
Browse files Browse the repository at this point in the history
Co-authored-by: tomiir <rocchitomas@gmail.com>
  • Loading branch information
codergon and tomiir committed Mar 27, 2024
1 parent c14add9 commit 39c78b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/scaffold/src/modal/w3m-account-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class W3mAccountButton extends LitElement {
<wui-account-button
.disabled=${Boolean(this.disabled)}
.isUnsupportedChain=${this.isUnsupportedChain}
address=${ifDefined(this.profileName ?? this.address)}
address=${ifDefined(this.address)}
profileName=${ifDefined(this.profileName)}
?isProfileName=${Boolean(this.profileName)}
networkSrc=${ifDefined(networkImage)}
avatarSrc=${ifDefined(this.profileImage)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class W3mAccountDefaultWidget extends LitElement {
this.profileName = val.profileName
this.balance = val.balance
this.balanceSymbol = val.balanceSymbol
} else {
} else if (!this.disconnecting) {
SnackController.showError('Account not found')
}
})
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/composites/wui-account-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export class WuiAccountButton extends LitElement {

@property() public address = ''

@property() public profileName = ''

@property() public charsStart = 4

@property() public charsEnd = 6
Expand All @@ -50,7 +52,7 @@ export class WuiAccountButton extends LitElement {
></wui-avatar>
<wui-text variant="paragraph-600" color="inherit">
${UiHelperUtil.getTruncateString({
string: this.address,
string: this.isProfileName ? this.profileName : this.address,
charsStart: this.isProfileName ? 18 : this.charsStart,
charsEnd: this.isProfileName ? 0 : this.charsEnd,
truncate: this.isProfileName ? 'end' : 'middle'
Expand Down

0 comments on commit 39c78b8

Please sign in to comment.