mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 23:04:06 +00:00
Cloud needs to wait for firebase auth to be ready.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user