Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 8e73505

Browse files
committed
fix(Identity): added loader during identity fetching
1 parent 4ba310b commit 8e73505

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

components/shared/format/Identity.vue

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@
2222
</a>
2323
</template>
2424
<template v-else>
25-
{{ name | toString }}
25+
<span v-if="showOnchainIdentity" class="is-inline-flex is-align-items-center">
26+
{{ shortenedAddress | toString }}
27+
<img v-if="isFetchingIdentity" src="/infinity.svg" class="ml-1 infinity-loader">
28+
<template v-else>
29+
<span v-if="identity.display" class="ml-1">({{ identity.display }})</span>
30+
</template>
31+
</span>
32+
<span v-else>
33+
{{ name | toString }}
34+
</span>
2635
</template>
2736
</component>
2837
</template>
@@ -52,13 +61,17 @@ export default class Identity extends mixins(InlineMixin) {
5261
@Prop(Boolean) public noOwerflow!: boolean;
5362
@Prop(Boolean) public emit!: boolean;
5463
@Prop(Boolean) public showTwitter!: boolean;
64+
@Prop(Boolean) public showOnchainIdentity!: boolean;
5565
private identity: IdentityFields = emptyObject<IdentityFields>();
66+
private isFetchingIdentity = false
67+
68+
get shortenedAddress(): Address {
69+
return shortAddress(this.resolveAddress(this.address))
70+
}
5671
5772
get name(): Address {
5873
const name = this.identity.display
59-
return name
60-
? `${shortAddress(this.resolveAddress(this.address))} (${name})`
61-
: shortAddress(this.resolveAddress(this.address))
74+
return name as string || this.shortenedAddress
6275
}
6376
6477
get twitter(): Address {
@@ -109,12 +122,14 @@ export default class Identity extends mixins(InlineMixin) {
109122
}
110123
111124
protected async fetchIdentity(address: string): Promise<IdentityFields> {
125+
this.isFetchingIdentity = true
112126
const { api } = Connector.getInstance()
113127
114128
const optionIdentity = await api?.query.identity?.identityOf(address)
115129
const identity = optionIdentity?.unwrapOrDefault()
116130
117131
if (!identity?.size) {
132+
this.isFetchingIdentity = false
118133
return emptyObject<IdentityFields>()
119134
}
120135
@@ -126,6 +141,7 @@ export default class Identity extends mixins(InlineMixin) {
126141
}, {} as IdentityFields)
127142
128143
update(address, () => final, identityStore)
144+
this.isFetchingIdentity = false
129145
130146
if (this.emit) {
131147
this.emitIdentityChange(final)
@@ -159,4 +175,8 @@ export default class Identity extends mixins(InlineMixin) {
159175
.overflowWrap {
160176
overflow-wrap: break-word;
161177
}
178+
179+
.infinity-loader {
180+
height: 20px
181+
}
162182
</style>

pages/transfer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
ref="identity"
4646
:address="$route.query.target"
4747
inline
48+
show-onchain-identity
4849
/>
4950
</a>
5051
</div>

0 commit comments

Comments
 (0)