Comfy-Org / Comfy-Org/ComfyUI_frontend

fix: add timeout to until(isAuthenticated).toBe(true) in bootstrapStore to prevent indefinite hang

Open
#10,171 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
area:auth Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

In `src/stores/bootstrapStore.ts`, the call `await until(isAuthenticated).toBe(true)` has no timeout. If Firebase initializes successfully but the authentication state never resolves to `true` (e.g., corrupted session, network failure during token refresh), the bootstrap will hang indefinitely — no stores load, no UI renders, and no error is surfaced to the user.

## Problem

The existing router guard in `router.ts` (line 146) already uses a defensive timeout pattern for `isInitialized`:
```ts
await until(isInitialized).toBe(true, { timeout: 16_000 })
```

However, the new `await until(isAuthenticated).toBe(true)` added in PR #9909 has no equivalent guard.

## Proposed Fix

Add a matching timeout and error handling:
```ts
await until(isAuthenticated).toBe(true, { timeout: 16_000 })
```
With a `catch` block that redirects the user to the login page or surfaces a meaningful error state, preventing silent UI freezes.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9909
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9909#discussion_r2945644014
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10171-fix-add-timeout-to-until-isAuthenticated-toBe-true-in-bootstrapStore-to-prevent-in-3266d73d365081b3acdfffdaec455d8d) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.