Skip to content

Conversation

built-by-as
Copy link
Owner

Summary

  • Extracted duplicated git branch loading logic into a shared loadAndPopulateBranches function
  • Reduced code duplication across directory selection handlers

Changes

  • Created loadAndPopulateBranches helper function in renderer.ts (line 219)
  • Refactored browse directory button handler to use the shared function
  • Refactored new session modal initialization to use the shared function

Benefits

  • Eliminates ~30 lines of duplicated code
  • Improves maintainability by centralizing branch loading logic
  • Consistent behavior across both directory selection flows
  • Optional parameter supports pre-selecting a specific branch

Test plan

  • Verify browsing for a directory loads branches correctly
  • Verify opening new session modal loads branches from last settings
  • Verify selected branch is properly pre-selected when opening the modal
  • Verify "No git repository found" message displays when appropriate

Extract duplicated git branch loading and population logic into a shared
loadAndPopulateBranches function to reduce code duplication and improve
maintainability.
Remove selectElement parameter and use the module-level parentBranchSelect
variable directly, simplifying the function signature.
@built-by-as built-by-as merged commit cdbae45 into main Oct 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant