-
Notifications
You must be signed in to change notification settings - Fork 511
fix: await needsLogin #8340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: await needsLogin #8340
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| import { until, useAsyncState } from '@vueuse/core' | ||
| import { defineStore, storeToRefs } from 'pinia' | ||
|
|
||
| import { isCloud } from '@/platform/distribution/types' | ||
| 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' | ||
| import { useUserStore } from '@/stores/userStore' | ||
|
|
||
| export const useBootstrapStore = defineStore('bootstrap', () => { | ||
| const settingStore = useSettingStore() | ||
|
|
@@ -26,9 +26,16 @@ export const useBootstrapStore = defineStore('bootstrap', () => { | |
| { immediate: false } | ||
| ) | ||
|
|
||
| let storesLoaded = false | ||
|
|
||
| function loadAuthenticatedStores() { | ||
| if (storesLoaded) return | ||
| storesLoaded = true | ||
| void settingStore.load() | ||
| void workflowStore.loadWorkflows() | ||
| } | ||
|
|
||
| async function startStoreBootstrap() { | ||
| // Defer settings and workflows if multi-user login is required | ||
| // (settings API requires authentication in multi-user mode) | ||
| const userStore = useUserStore() | ||
| await userStore.initialize() | ||
|
|
||
|
|
@@ -37,13 +44,11 @@ export const useBootstrapStore = defineStore('bootstrap', () => { | |
| await until(isInitialized).toBe(true) | ||
| } | ||
|
|
||
| // i18n can load without authentication | ||
| void loadI18n() | ||
| const { needsLogin } = storeToRefs(userStore) | ||
| await until(needsLogin).toBe(false) | ||
|
|
||
| if (!userStore.needsLogin) { | ||
| void settingStore.load() | ||
| void workflowStore.loadWorkflows() | ||
| } | ||
| void loadI18n() | ||
| loadAuthenticatedStores() | ||
|
Comment on lines
+47
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# First, get the repository structure overview
echo "=== Repository structure ==="
find . -type f -name "*.ts" -path "*store*" | grep -E "(bootstrap|user)" | head -20
echo ""
echo "=== Check bootstrapStore.ts content ==="
cat -n src/stores/bootstrapStore.ts | head -80Repository: Comfy-Org/ComfyUI_frontend Length of output: 2313 🏁 Script executed: #!/bin/bash
# Check userStore implementation
echo "=== Check userStore.ts for needsLogin ==="
fd "userStore.ts$" --exec cat -n {} \;
echo ""
echo "=== Search for needsLogin usage pattern ==="
rg "needsLogin" -n -C3 --type tsRepository: Comfy-Org/ComfyUI_frontend Length of output: 5395 🏁 Script executed: #!/bin/bash
# Check how startStoreBootstrap is called and used
echo "=== Check startStoreBootstrap usage ==="
rg "startStoreBootstrap" -n -B2 -A2 --type ts --type vue
echo ""
echo "=== Check if bootstrap completion is awaited in App.vue or main.ts ==="
rg -n "bootstrap|isI18nReady|needsLogin" src/App.vue src/main.ts --type vue --type ts 2>/dev/null | head -30Repository: Comfy-Org/ComfyUI_frontend Length of output: 226 🏁 Script executed: #!/bin/bash
# Check if there's a timeout mechanism in the bootstrap flow
echo "=== Search for timeout in bootstrap or until usage ==="
rg "until.*toBe|timeout|abortSignal" -n --type ts | grep -E "(bootstrap|until|timeout)"
echo ""
echo "=== Check the 'until' function import ==="
rg "import.*until" -n --type tsRepository: Comfy-Org/ComfyUI_frontend Length of output: 15501 🏁 Script executed: #!/bin/bash
# Understand the user authentication flow
echo "=== Check user initialization and login flow ==="
rg "initialize|needsLogin.*true|needsLogin.*false|setNeedsLogin" -n -C2 --type ts | head -50Repository: Comfy-Org/ComfyUI_frontend Length of output: 4777 🏁 Script executed: #!/bin/bash
# Search for startStoreBootstrap invocation
echo "=== Searching for startStoreBootstrap calls ==="
rg "startStoreBootstrap" -n --type ts --type vue
echo ""
echo "=== Check App initialization in main files ==="
fd -e ts -e vue "main\.(ts|vue)$|App\.(ts|vue)$" | head -10 | xargs -I {} bash -c 'echo "=== {} ===" && head -50 {}'Repository: Comfy-Org/ComfyUI_frontend Length of output: 4777 🏁 Script executed: #!/bin/bash
# Check if bootstrap is awaited at application startup
echo "=== Search for bootstrap in entry points ==="
find . -name "main.ts" -o -name "main.js" | xargs cat 2>/dev/null | head -100
echo ""
echo "=== Check vite.config or entry points ==="
find . \( -name "vite.config.*" -o -name "tsconfig.json" \) -exec grep -l "entry\|src/main" {} \;Repository: Comfy-Org/ComfyUI_frontend Length of output: 3380 🏁 Script executed: #!/bin/bash
# Look at App.vue setup
echo "=== Check App.vue or root component ==="
find src -name "App.vue" -o -name "App.ts" | xargs cat 2>/dev/null | head -100Repository: Comfy-Org/ComfyUI_frontend Length of output: 2133 🏁 Script executed: #!/bin/bash
# Search for router guards and how bootstrap is used
echo "=== Check router.ts for bootstrap usage ==="
cat -n src/router.ts | head -200
echo ""
echo "=== Search specifically for bootstrap in router ==="
rg "bootstrap|startStoreBootstrap" src/router.ts -n -A3 -B3Repository: Comfy-Org/ComfyUI_frontend Length of output: 7292 🏁 Script executed: #!/bin/bash
# Check if bootstrap is called in beforeEach or other router hooks
echo "=== Full router.ts ==="
wc -l src/router.ts && echo "File is large, checking structure..." && grep -n "beforeEach\|startStoreBootstrap\|Bootstrap" src/router.tsRepository: Comfy-Org/ComfyUI_frontend Length of output: 200 🏁 Script executed: #!/bin/bash
# Get full main.ts content
echo "=== Full main.ts content ==="
cat -n src/main.tsRepository: Comfy-Org/ComfyUI_frontend Length of output: 3541 🏁 Script executed: #!/bin/bash
# Search more broadly for useBootstrapStore usage
echo "=== Search for useBootstrapStore usage ==="
rg "useBootstrapStore" -n --type ts
echo ""
echo "=== Check if bootstrap is referenced anywhere ==="
rg "startStoreBootstrap|useBootstrapStore" -r . --type tsRepository: Comfy-Org/ComfyUI_frontend Length of output: 1386 🏁 Script executed: #!/bin/bash
# Verify the until function signature and confirm no default timeout
echo "=== Check VueUse documentation for until() ==="
rg "from '@vueuse/core'" -A5 src/router.ts src/stores/bootstrapStore.ts
echo ""
echo "=== Check if there's any error handling around the until() call ==="
cat -n src/stores/bootstrapStore.ts | sed -n '38,52p'Repository: Comfy-Org/ComfyUI_frontend Length of output: 1399 Add timeout to The Add a timeout parameter matching the pattern used in The same issue exists on line 44 for Firebase auth initialization in cloud mode—both 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gasp