From 5dab0d6adf44c419a22f9368e47d80e8b91c8fd4 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 7 Feb 2023 20:47:54 +0800 Subject: [PATCH] fix duplicated load --- src/layouts/components/Navbar.vue | 43 ++++++++++++++++++------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/layouts/components/Navbar.vue b/src/layouts/components/Navbar.vue index a7571c93..9790ae65 100644 --- a/src/layouts/components/Navbar.vue +++ b/src/layouts/components/Navbar.vue @@ -117,7 +117,7 @@ {{ item.wallet }} { - const name = { - name: res.data, - provider: 'Stargaze', - } - if (this.names[v]) { - this.names[v].push(name) - } else { - this.names[v] = [name] - } - }) - resolvePrimaryDomainByAddress(this.address).then(result => { - if (result.isOk()) { + if (!this.loading.includes(v)) { + this.loading.push(v) + this.$http.resolveStarName(v).then(res => { const name = { - name: result.value, - provider: 'IBC Domain', + name: res.data, + provider: 'Stargaze', } if (this.names[v]) { this.names[v].push(name) } else { this.names[v] = [name] } - } - }) + }) + resolvePrimaryDomainByAddress(this.address).then(result => { + if (result.isOk()) { + const name = { + name: result.value, + provider: 'IBC Domain', + } + if (this.names[v]) { + this.names[v].push(name) + } else { + this.names[v] = [name] + } + } + }) + } return v.substring(0, 10).concat('...', v.substring(v.length - 10)) }, updateDefaultWallet(v) {