From fc57e87f2d61a0203fdc8c91d69bce975a1168af Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sun, 21 Jan 2024 12:08:48 +0800 Subject: [PATCH] improve 24hours loading --- src/modules/[chain]/staking/index.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/[chain]/staking/index.vue b/src/modules/[chain]/staking/index.vue index e93aa69d..814db177 100644 --- a/src/modules/[chain]/staking/index.vue +++ b/src/modules/[chain]/staking/index.vue @@ -71,6 +71,7 @@ async function fetchChange() { } } + const changes = computed(() => { const changes = {} as Record; Object.keys(latest.value).forEach((k) => { @@ -197,7 +198,14 @@ const logo = (identity?: string) => { : `https://s3.amazonaws.com/keybase_processed_uploads/${url}`; }; -fetchChange(); +let height_in_24h = ref(0) +base.$subscribe((_, s) => { + if (Number(s.earlest.block.header.height) !== height_in_24h.value) { + height_in_24h.value = Number(s.earlest.block.header.height); + fetchChange(); + } +}); + loadAvatars();