Fix diff indicators not restored when reopening remote project (#31384)

Closes #30917

Release Notes:

- Fix diff indicators not restored when reopening remote project

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
feeiyu 2025-06-17 22:07:51 +08:00 committed by GitHub
parent b686fb2917
commit c766f52f88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 192 additions and 7 deletions

View file

@ -134,6 +134,7 @@ use project::{
},
session::{Session, SessionEvent},
},
git_store::{GitStoreEvent, RepositoryEvent},
project_settings::DiagnosticSeverity,
};
@ -1866,6 +1867,31 @@ impl Editor {
_ => {}
},
));
let git_store = project.read(cx).git_store().clone();
let project = project.clone();
project_subscriptions.push(cx.subscribe(&git_store, move |this, _, event, cx| {
match event {
GitStoreEvent::RepositoryUpdated(
_,
RepositoryEvent::Updated {
new_instance: true, ..
},
_,
) => {
this.load_diff_task = Some(
update_uncommitted_diff_for_buffer(
cx.entity(),
&project,
this.buffer.read(cx).all_buffers(),
this.buffer.clone(),
cx,
)
.shared(),
);
}
_ => {}
}
}));
}
}