ITADN

fix: resolve race condition causing false domain-already-taken on app edit

#739Pull RequestJamesSprow 创建于 2026-04-12
J
JamesSprowcommented
## Summary Fixes #738 **Problem:** Editing any existing Kubero app shows "domain already taken" and Save is disabled, even though the domain belongs to the app being edited. **Root cause:** Race condition in `mounted()`. `getDomains()` and `loadPipelineAndApp()` run concurrently via `Promise.all`. Inside `loadPipelineAndApp()`, `loadApp()` was not awaited, so `getDomains()` resolved first with `this.ingress.hosts` still empty — the app's own domain was never excluded from `takenDomains`. `whiteListDomains()` also had a splice-while-iterating bug that made it unreliable even when called in the right order. ## Changes - **`loadApp()`** — made `async`, returns the promise - **`loadPipelineAndApp()`** — now `await`s `loadApp()` so `this.ingress.hosts` is populated before `getDomains()` / `whiteListDomains()` runs - **`whiteListDomains()`** — replaced mutating splice loop with `Set` + `filter` (no more index drift bug) - Removed the now-redundant `whiteListDomains()` call inside `loadApp()` itself (it was already handled in `getDomains()`) ## Test plan - [ ] Create an app with a custom domain - [ ] Navigate to edit that app — Save should be enabled and domain should not be flagged as taken - [ ] Create two apps with different domains — editing either should not flag the other as taken on the same form - [ ] New-app flow: all existing domains should still be correctly flagged as taken
合并状态:未合并 1 条评论