vcs_menu: Query branches on open instead of per keystroke (#3144)

Release Notes:

- Improved performance of branch picker by querying branches on menu
open instead of querying once per each keystroke. (fixes
zed-industries/community#2161)
This commit is contained in:
Piotr Osiewicz 2023-10-21 14:01:01 +02:00 committed by GitHub
parent 26638748bb
commit fc37abc356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 67 deletions

View file

@ -488,7 +488,11 @@ impl CollabTitlebarItem {
pub fn toggle_vcs_menu(&mut self, _: &ToggleVcsMenu, cx: &mut ViewContext<Self>) {
if self.branch_popover.take().is_none() {
if let Some(workspace) = self.workspace.upgrade(cx) {
let view = cx.add_view(|cx| build_branch_list(workspace, cx));
let Some(view) =
cx.add_option_view(|cx| build_branch_list(workspace, cx).log_err())
else {
return;
};
cx.subscribe(&view, |this, _, event, cx| {
match event {
PickerEvent::Dismiss => {