Use read-only access methods for read-only entity operations (#31479)
Another follow-up to #31254 Release Notes: - N/A
This commit is contained in:
parent
4a577fff4a
commit
c208532693
79 changed files with 319 additions and 306 deletions
|
@ -383,7 +383,7 @@ impl HeadlessProject {
|
|||
};
|
||||
|
||||
let worktree = this
|
||||
.update(&mut cx.clone(), |this, _| {
|
||||
.read_with(&mut cx.clone(), |this, _| {
|
||||
Worktree::local(
|
||||
Arc::from(canonicalized.as_path()),
|
||||
message.payload.visible,
|
||||
|
@ -394,11 +394,12 @@ impl HeadlessProject {
|
|||
})?
|
||||
.await?;
|
||||
|
||||
let response = this.update(&mut cx, |_, cx| {
|
||||
worktree.update(cx, |worktree, _| proto::AddWorktreeResponse {
|
||||
let response = this.read_with(&mut cx, |_, cx| {
|
||||
let worktree = worktree.read(cx);
|
||||
proto::AddWorktreeResponse {
|
||||
worktree_id: worktree.id().to_proto(),
|
||||
canonicalized_path: canonicalized.to_proto(),
|
||||
})
|
||||
}
|
||||
})?;
|
||||
|
||||
// We spawn this asynchronously, so that we can send the response back
|
||||
|
@ -572,7 +573,7 @@ impl HeadlessProject {
|
|||
let buffer_store = this.read_with(&cx, |this, _| this.buffer_store.clone())?;
|
||||
|
||||
while let Ok(buffer) = results.recv().await {
|
||||
let buffer_id = buffer.update(&mut cx, |this, _| this.remote_id())?;
|
||||
let buffer_id = buffer.read_with(&mut cx, |this, _| this.remote_id())?;
|
||||
response.buffer_ids.push(buffer_id.to_proto());
|
||||
buffer_store
|
||||
.update(&mut cx, |buffer_store, cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue