fix: broken Firebase auth gate in API layer

waitForAuthInitialization was silently passing through without
waiting. authStore.isInitialized is unwrapped by Pinia (plain
boolean, not a ref), and until() without .toBe() returns a
builder object, not a promise — so Promise.race resolved
immediately.

Fix with storeToRefs to preserve the ref and .toBe(true) to
get an actual promise.
This commit is contained in:
Matt Miller
2026-03-16 10:30:22 -07:00
parent 45b3e0ec64
commit 955195e622

View File

@@ -1,5 +1,6 @@
import { promiseTimeout, until } from '@vueuse/core'
import axios from 'axios'
import { storeToRefs } from 'pinia'
import { get } from 'es-toolkit/compat'
import { trimEnd } from 'es-toolkit'
import { ref } from 'vue'
@@ -414,9 +415,10 @@ export class ComfyApi extends EventTarget {
if (authStore.isInitialized) return
const { isInitialized } = storeToRefs(authStore)
try {
await Promise.race([
until(authStore.isInitialized),
until(isInitialized).toBe(true),
promiseTimeout(10000)
])
} catch {