mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Grab latest snapshot when invoking LocalWorktree::poll_snapshot
This commit is contained in:
parent
833aa726d5
commit
a42399bcf3
1 changed files with 3 additions and 6 deletions
|
@ -495,10 +495,10 @@ impl LocalWorktree {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_snapshot(&mut self, cx: &mut ModelContext<Worktree>) {
|
fn poll_snapshot(&mut self, cx: &mut ModelContext<Worktree>) {
|
||||||
|
self.poll_task.take();
|
||||||
|
self.snapshot = self.background_snapshot.lock().clone();
|
||||||
match self.scan_state() {
|
match self.scan_state() {
|
||||||
ScanState::Idle => {
|
ScanState::Idle => {
|
||||||
self.poll_task.take();
|
|
||||||
self.snapshot = self.background_snapshot.lock().clone();
|
|
||||||
if let Some(share) = self.share.as_mut() {
|
if let Some(share) = self.share.as_mut() {
|
||||||
*share.snapshots_tx.borrow_mut() = self.snapshot.clone();
|
*share.snapshots_tx.borrow_mut() = self.snapshot.clone();
|
||||||
}
|
}
|
||||||
|
@ -516,10 +516,7 @@ impl LocalWorktree {
|
||||||
smol::Timer::after(Duration::from_millis(100)).await;
|
smol::Timer::after(Duration::from_millis(100)).await;
|
||||||
}
|
}
|
||||||
if let Some(this) = this.upgrade(&cx) {
|
if let Some(this) = this.upgrade(&cx) {
|
||||||
this.update(&mut cx, |this, cx| {
|
this.update(&mut cx, |this, cx| this.poll_snapshot(cx));
|
||||||
this.as_local_mut().unwrap().poll_task = None;
|
|
||||||
this.poll_snapshot(cx);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue