Comfy-Org / Comfy-Org/ComfyUI_frontend

Handle initialization errors in UserSelectView

Open
#11,960 0 comments 0 reactions 1 assignee Claimed by @pythongosssss View on GitHub
area:auth
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

The `onMounted` handler in `src/views/UserSelectView.vue` currently awaits `userStore.initialize()` without catching potential failures, which can result in an unhandled promise rejection and no user-facing error feedback.

The component already has a `loginError` ref that is used to surface errors in the UI — initialization errors should be caught and assigned to `loginError` so the user sees a meaningful message instead of a silent failure.

## Steps to reproduce

1. Cause `userStore.initialize()` (i.e. `api.getUserConfig()`) to reject (e.g. network error on startup).
2. Navigate to `UserSelectView`.
3. Observe no error is shown in the UI and an unhandled promise rejection is raised in the console.

## Proposed fix

```diff
onMounted(async () => {
document.getElementById('splash-loader')?.remove()
- await userStore.initialize()
+ try {
+ await userStore.initialize()
+ } catch (err) {
+ loginError.value =
+ err instanceof Error ? err.message : JSON.stringify(err)
+ }
})
```

## References

- Flagged during review of PR #11959 (comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11959#discussion_r3187851850)
- Requested by: @pythongosssss

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11960-Handle-initialization-errors-in-UserSelectView-3576d73d3650815e9890f06c9c1e251d) 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.