From bdb2643b338169b4caa01eb5e6278c14d393b462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Mon, 23 Sep 2024 18:08:02 +0200 Subject: [PATCH] fix: prevent reloading page (#2973) --- composables/users.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composables/users.ts b/composables/users.ts index 1b3fca0fce..a42e51bd8d 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -57,8 +57,14 @@ export const isGlitchEdition = computed(() => currentInstance.value?.version?.in // when multiple tabs: we need to reload window when sign in, switch account or sign out if (import.meta.client) { + // fix #2972: now users loaded from idb, we need to wait for it + const initialLoad = ref(true) + watchOnce(users, () => { + initialLoad.value = false + }, { immediate: true, flush: 'sync' }) + const windowReload = () => { - if (document.visibilityState === 'visible') + if (document.visibilityState === 'visible' && !initialLoad.value) window.location.reload() } watch(currentUserHandle, async (handle, oldHandle) => {