fix status_tree not showing while first status loading

This commit is contained in:
extrawurst 2022-11-21 14:45:03 +01:00
parent 3667db37e1
commit 3fee481e8d
3 changed files with 23 additions and 0 deletions

View File

@ -320,7 +320,21 @@ impl Component for ChangesComponent {
fn focused(&self) -> bool {
self.files.focused()
}
fn focus(&mut self, focus: bool) {
self.files.focus(focus);
}
fn is_visible(&self) -> bool {
self.files.is_visible()
}
fn hide(&mut self) {
self.files.hide();
}
fn show(&mut self) -> Result<()> {
self.files.show()?;
Ok(())
}
}

View File

@ -70,6 +70,7 @@ impl StatusTreeComponent {
///
pub fn update(&mut self, list: &[StatusItem]) -> Result<()> {
self.pending = false;
let new_hash = hash(list);
if self.current_hash != new_hash {
self.tree.update(list)?;
@ -373,6 +374,7 @@ impl DrawableComponent for StatusTreeComponent {
)
})
.skip(self.scroll_top.get());
ui::draw_list(
f,
r,

View File

@ -427,6 +427,7 @@ impl Status {
}
fn check_remotes(&mut self) {
//TODO: make get_branches_info async
self.has_remotes =
sync::get_branches_info(&self.repo.borrow(), false)
.map(|branches| !branches.is_empty())
@ -965,10 +966,16 @@ impl Component for Status {
fn hide(&mut self) {
self.visible = false;
self.index.hide();
self.index_wd.hide();
}
fn show(&mut self) -> Result<()> {
self.visible = true;
self.index.show()?;
self.index_wd.show()?;
self.check_remotes();
self.update()?;