Skip to content

Commit 3fee481

Browse files
committed
fix status_tree not showing while first status loading
1 parent 3667db3 commit 3fee481

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

Diff for: src/components/changes.rs

+14
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,21 @@ impl Component for ChangesComponent {
320320
fn focused(&self) -> bool {
321321
self.files.focused()
322322
}
323+
323324
fn focus(&mut self, focus: bool) {
324325
self.files.focus(focus);
325326
}
327+
328+
fn is_visible(&self) -> bool {
329+
self.files.is_visible()
330+
}
331+
332+
fn hide(&mut self) {
333+
self.files.hide();
334+
}
335+
336+
fn show(&mut self) -> Result<()> {
337+
self.files.show()?;
338+
Ok(())
339+
}
326340
}

Diff for: src/components/status_tree.rs

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl StatusTreeComponent {
7070
///
7171
pub fn update(&mut self, list: &[StatusItem]) -> Result<()> {
7272
self.pending = false;
73+
7374
let new_hash = hash(list);
7475
if self.current_hash != new_hash {
7576
self.tree.update(list)?;
@@ -373,6 +374,7 @@ impl DrawableComponent for StatusTreeComponent {
373374
)
374375
})
375376
.skip(self.scroll_top.get());
377+
376378
ui::draw_list(
377379
f,
378380
r,

Diff for: src/tabs/status.rs

+7
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ impl Status {
427427
}
428428

429429
fn check_remotes(&mut self) {
430+
//TODO: make get_branches_info async
430431
self.has_remotes =
431432
sync::get_branches_info(&self.repo.borrow(), false)
432433
.map(|branches| !branches.is_empty())
@@ -965,10 +966,16 @@ impl Component for Status {
965966

966967
fn hide(&mut self) {
967968
self.visible = false;
969+
970+
self.index.hide();
971+
self.index_wd.hide();
968972
}
969973

970974
fn show(&mut self) -> Result<()> {
971975
self.visible = true;
976+
self.index.show()?;
977+
self.index_wd.show()?;
978+
972979
self.check_remotes();
973980
self.update()?;
974981

0 commit comments

Comments
 (0)