Skip to content

Commit

Permalink
assistant2: Inline read calls (#22982)
Browse files Browse the repository at this point in the history
This PR inlines the `read` calls on models in a few spots.

Release Notes:

- N/A
  • Loading branch information
maxdeviant authored Jan 10, 2025
1 parent 0f1c2a8 commit dad1a3b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/assistant2/src/context_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,9 @@ impl ContextStore {

pub fn insert_thread(&mut self, thread: Model<Thread>, cx: &AppContext) {
let id = self.next_context_id.post_inc();
let thread_ref = thread.read(cx);
let text = thread_ref.text().into();
let text = thread.read(cx).text().into();

self.threads.insert(thread_ref.id().clone(), id);
self.threads.insert(thread.read(cx).id().clone(), id);
self.context
.push(Context::Thread(ThreadContext { id, thread, text }));
}
Expand Down Expand Up @@ -499,8 +498,7 @@ pub fn refresh_context_store_text(
cx: &AppContext,
) -> impl Future<Output = ()> {
let mut tasks = Vec::new();
let context_store_ref = context_store.read(cx);
for context in &context_store_ref.context {
for context in &context_store.read(cx).context {
match context {
Context::File(file_context) => {
let context_store = context_store.clone();
Expand Down

0 comments on commit dad1a3b

Please sign in to comment.