Initialize the first repo when building the panel

Co-Authored-By: Cole Miller <53574922+cole-miller@users.noreply.github.com>
This commit is contained in:
Nate Butler
2025-01-08 14:15:45 -05:00
parent c25079adb6
commit ae50babfb4

View File

@@ -183,6 +183,19 @@ impl GitPanel {
let scroll_handle = UniformListScrollHandle::new();
git_state.update(cx, |state, cx| {
let mut visible_worktrees = project.read(cx).visible_worktrees(cx);
let Some(first_worktree) = visible_worktrees.next() else {
return;
};
drop(visible_worktrees);
let snapshot = first_worktree.read(cx).snapshot();
if let Some(repository) = first_worktree_repository(&project, snapshot.id(), cx) {
state.activate_repository(repository);
}
});
let mut git_panel = Self {
focus_handle: cx.focus_handle(),
fs,