fix: fine tune git reload updates, fix lazy load underflow
Only refresh the git history on repo change events, seems to be a few other git store events that trigger lots of frequent changes Fix subtract with overflow Removes some extra clones
This commit is contained in:
parent
eb01cd2ad3
commit
efc009ee65
1 changed files with 10 additions and 12 deletions
|
@ -53,8 +53,10 @@ impl GitCommitList {
|
||||||
this.reload_history(window, cx)
|
this.reload_history(window, cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload the history for any other changes
|
// Reload the git history on repository changes to the current repo
|
||||||
_ => this.reload_history(window, cx),
|
GitStoreEvent::RepositoryUpdated(_, _, true) => this.reload_history(window, cx),
|
||||||
|
|
||||||
|
_ => {}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
@ -62,7 +64,10 @@ impl GitCommitList {
|
||||||
let commits_list = ListState::new(0, gpui::ListAlignment::Top, px(1000.));
|
let commits_list = ListState::new(0, gpui::ListAlignment::Top, px(1000.));
|
||||||
commits_list.set_scroll_handler(cx.listener(
|
commits_list.set_scroll_handler(cx.listener(
|
||||||
|this: &mut Self, event: &ListScrollEvent, window, cx| {
|
|this: &mut Self, event: &ListScrollEvent, window, cx| {
|
||||||
if event.visible_range.end >= this.commits.len() - 5 && this.has_next_page() {
|
if this.commits.len() > 5
|
||||||
|
&& event.visible_range.end >= this.commits.len() - 5
|
||||||
|
&& this.has_next_page()
|
||||||
|
{
|
||||||
this.load_next_history_page(window, cx);
|
this.load_next_history_page(window, cx);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -125,7 +130,7 @@ impl GitCommitList {
|
||||||
author_email: commit.author_email.clone(),
|
author_email: commit.author_email.clone(),
|
||||||
commit_time: OffsetDateTime::from_unix_timestamp(commit.commit_timestamp)?,
|
commit_time: OffsetDateTime::from_unix_timestamp(commit.commit_timestamp)?,
|
||||||
message: Some(ParsedCommitMessage {
|
message: Some(ParsedCommitMessage {
|
||||||
message: commit.message.clone(),
|
message: commit.message,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
@ -209,7 +214,6 @@ impl GitCommitList {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.on_click({
|
.on_click({
|
||||||
let commit = commit_summary.clone();
|
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
let repo = self.active_repository.as_ref().map(|repo| repo.downgrade());
|
let repo = self.active_repository.as_ref().map(|repo| repo.downgrade());
|
||||||
move |_, window, cx| {
|
move |_, window, cx| {
|
||||||
|
@ -217,13 +221,7 @@ impl GitCommitList {
|
||||||
Some(repo) => repo,
|
Some(repo) => repo,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
CommitView::open(
|
CommitView::open(commit_summary.clone(), repo, workspace.clone(), window, cx);
|
||||||
commit.clone(),
|
|
||||||
repo.clone(),
|
|
||||||
workspace.clone().clone(),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue