From e29352d0f1dfae37b48965ac9cab95ee4d91b5f0 Mon Sep 17 00:00:00 2001 From: Li Kui <90845831+likui628@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:53:44 +0800 Subject: [PATCH] fix: missing await for an async function call (#4035) --- packages/effects/hooks/src/use-refresh.ts | 4 ++-- packages/effects/hooks/src/use-tabs.ts | 2 +- packages/effects/hooks/src/use-watermark.ts | 10 +++++----- packages/stores/src/modules/tabbar.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/effects/hooks/src/use-refresh.ts b/packages/effects/hooks/src/use-refresh.ts index fc7f1175..b3a5caeb 100644 --- a/packages/effects/hooks/src/use-refresh.ts +++ b/packages/effects/hooks/src/use-refresh.ts @@ -6,8 +6,8 @@ export function useRefresh() { const router = useRouter(); const tabbarStore = useTabbarStore(); - function refresh() { - tabbarStore.refresh(router); + async function refresh() { + await tabbarStore.refresh(router); } return { diff --git a/packages/effects/hooks/src/use-tabs.ts b/packages/effects/hooks/src/use-tabs.ts index b26ede94..aa79d72f 100644 --- a/packages/effects/hooks/src/use-tabs.ts +++ b/packages/effects/hooks/src/use-tabs.ts @@ -44,7 +44,7 @@ export function useTabs() { } async function openTabInNewWindow(tab?: RouteLocationNormalized) { - tabbarStore.openTabInNewWindow(tab || route); + await tabbarStore.openTabInNewWindow(tab || route); } async function closeTabByKey(key: string) { diff --git a/packages/effects/hooks/src/use-watermark.ts b/packages/effects/hooks/src/use-watermark.ts index 5c2a92d6..0efd4391 100644 --- a/packages/effects/hooks/src/use-watermark.ts +++ b/packages/effects/hooks/src/use-watermark.ts @@ -48,18 +48,18 @@ export function useWatermark() { }; watermark.value = new Watermark(cachedOptions.value); - watermark.value?.create(); + await watermark.value?.create(); } async function updateWatermark(options: Partial) { - if (!watermark.value || !watermark.value?.check()) { - await initWatermark(options); - } else { + if (watermark.value) { await nextTick(); - watermark.value?.changeOptions({ + await watermark.value?.changeOptions({ ...cachedOptions.value, ...options, }); + } else { + await initWatermark(options); } } diff --git a/packages/stores/src/modules/tabbar.ts b/packages/stores/src/modules/tabbar.ts index b2d8eb73..8ba914eb 100644 --- a/packages/stores/src/modules/tabbar.ts +++ b/packages/stores/src/modules/tabbar.ts @@ -349,7 +349,7 @@ export const useTabbarStore = defineStore('core-tabbar', { } }, - async setUpdateTime() { + setUpdateTime() { this.updateTime = Date.now(); }, /**