Bug: Editing an app resets branch to default
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- frontend
Research direction
Read client/src/components/apps/form.vue, starting with loadPipelineAndApp() and the async loadBranches() and loadApp() calls around the referenced lines. Confirm that branch loading still populates branchesList, while editing preserves the saved branch and creating a new app selects the repository default; verify the create and edit flows in the Kubero UI.
Written by the indexing model from the issue text.
Description
Which component(s) is affected?
Kubero UI
Describe the bug
When editing an existing app that is configured to use a non-default branch (e.g. develop), the branch input field shows the repository's default branch (e.g. main) instead of the previously configured branch. If the user clicks "Save" without noticing, the app's branch is silently changed to the default — causing it to deploy from the wrong branch.
Steps to reproduce
- Create a pipeline connected to a git repository with multiple branches (e.g.
main,develop) - Create an app and set the branch to a non-default branch (e.g.
develop) - Save the app
- Navigate back to edit the same app
- Observe: The branch field shows
main(the default branch) instead ofdevelop - Click "Save" without changing anything
- Result: The app's branch is now changed to
main
Expected behavior
When editing an existing app, the branch field should show the branch that was previously configured and saved.
Screenshots
No response
Additional information
Root Cause
The bug is a race condition in client/src/components/apps/form.vue between two unawaited async calls in loadPipelineAndApp() (line 1928):
- Line 1936:
this.loadBranches()fires an async HTTP request to/api/repo/.../branches(NOT awaited) - Line 2004:
this.loadApp()fires an async HTTP request to/api/apps/...(NOT awaited)
Both .then() callbacks assign this.branch:
loadApp()(line 2141) correctly setsthis.branch = response.data.spec.branch(the saved value, e.g."develop")loadBranches()(lines 2037–2042) unconditionally overwritesthis.branchwithpipelineData.git.repository.default_branch(e.g."main")
Since loadBranches() calls an external git provider API (GitHub/GitLab/etc.), it is typically slower than loadApp() (which hits the local Kubernetes API). So the usual execution order is:
loadApp()resolves first → setsthis.branch = "develop"✅loadBranches()resolves second → overwritesthis.branch = "main"❌
Suggested Fix
Guard the branch assignment in loadBranches() so it only pre-selects a default branch when creating a new app:
// In loadBranches(), lines 2036-2042:
if (this.app == "new") {
let defaultBranch = this.pipelineData.git.repository.default_branch;
if (this.branchesList.includes(defaultBranch)) {
this.branch = defaultBranch;
} else {
this.branch = this.branchesList[0];
}
}
This ensures loadBranches() still populates the branchesList dropdown (needed for both create and edit), but only pre-selects a branch value during app creation. During edit, loadApp() retains the final say on this.branch.
Additional Context
- The server side correctly stores and returns
spec.branchfrom the KuberoApp CRD — no issue there - The kubero-operator (Helm-based) passes
spec.branchthrough to deployment templates without modification — no issue there - The bug is purely a frontend race condition
Debug information
No response
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kubero-dev/kubero
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
kubero-dev/kubero#798 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
kubero-dev/kubero#797 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
kubero-dev/kubero#744 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kubero-dev/kubero#738 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
kubero-dev/kubero#735 · 1 comment · 3 reactions ·
All issues in kubero-dev/kubero
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100