mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-13 17:26:22 +00:00
## Summary Make `userStore.initialize()` idempotent and concurrency-safe so the bootstrap, router-guard, and UserSelectView callers share a single getUserConfig fetch instead of racing/duplicaitng calls. ## Changes - **What**: - cache initialize in a promise so callers all re-use the same result - remove now redundant is initialized guard - tests ## Review Focus - Current user switch/logout uses `window.location.reload()`, no callers intentionally call initialize to reinit. In future if this changes we may want to add a parameter to skip the cache or a separate function. - Failed initializes are not cached to allow callers to retry - Not practical for e2e tests, the unit tests prove that the requests are deduped. All a e2e test would do is mock/spy on the network requests to show multiple requests do not happen - which the unit tests do a better job of. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11959-fix-add-guard-to-prevent-user-store-re-initialization-3576d73d3650817db7b0e52cc25f9b7b) by [Unito](https://www.unito.io)