From 07e6daa38e1b1d5bb47addab1fb562100d9371b4 Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Mon, 26 Jan 2026 18:41:15 -0800 Subject: [PATCH] Cloud needs to wait for firebase auth to be ready. --- src/platform/settings/settingStore.ts | 6 +++++- src/stores/bootstrapStore.ts | 15 +++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/platform/settings/settingStore.ts b/src/platform/settings/settingStore.ts index cbaf7d1fbf..ed46c8b002 100644 --- a/src/platform/settings/settingStore.ts +++ b/src/platform/settings/settingStore.ts @@ -1,3 +1,4 @@ +import { retry } from 'es-toolkit' import _ from 'es-toolkit/compat' import { useAsyncState } from '@vueuse/core' import { defineStore } from 'pinia' @@ -60,7 +61,10 @@ export const useSettingStore = defineStore('setting', () => { 'Setting values must be loaded before any setting is registered.' ) } - settingValues.value = await api.getSettings() + settingValues.value = await retry(() => api.getSettings(), { + retries: 3, + delay: (attempt) => Math.min(1000 * Math.pow(2, attempt), 8000) + }) await migrateZoomThresholdToFontSize() }, undefined, diff --git a/src/stores/bootstrapStore.ts b/src/stores/bootstrapStore.ts index 224d570ca6..63eb00715a 100644 --- a/src/stores/bootstrapStore.ts +++ b/src/stores/bootstrapStore.ts @@ -1,10 +1,12 @@ -import { useAsyncState } from '@vueuse/core' -import { defineStore } from 'pinia' +import { until, useAsyncState } from '@vueuse/core' +import { defineStore, storeToRefs } from 'pinia' import { useSettingStore } from '@/platform/settings/settingStore' import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore' import { api } from '@/scripts/api' import { useUserStore } from '@/stores/userStore' +import { isCloud } from '@/platform/distribution/types' +import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore' export const useBootstrapStore = defineStore('bootstrap', () => { const settingStore = useSettingStore() @@ -30,12 +32,17 @@ export const useBootstrapStore = defineStore('bootstrap', () => { const userStore = useUserStore() await userStore.initialize() + if (isCloud) { + const { isInitialized } = storeToRefs(useFirebaseAuthStore()) + await until(isInitialized).toBe(true) + } + // i18n can load without authentication void loadI18n() if (!userStore.needsLogin) { - await settingStore.load() - await workflowStore.loadWorkflows() + void settingStore.load() + void workflowStore.loadWorkflows() } }