Skip to content

Commit

Permalink
fix(query): After retrieval current transormation should be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
timonv committed Aug 15, 2024
1 parent 501321f commit 8a1cc69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions swiftide-core/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@ impl Query<states::Pending> {

/// Add retrieved documents and transition to `states::Retrieved`
pub fn retrieved_documents(mut self, documents: Vec<Document>) -> Query<states::Retrieved> {
let new_response = String::new();

self.transformation_history
.push(TransformationEvent::Retrieved {
before: self.current.clone(),
after: new_response.clone(),
after: String::new(),
documents: documents.clone(),
});

let state = states::Retrieved { documents };

self.current.clear();
self.transition_to(state)
}
}
Expand Down Expand Up @@ -200,6 +199,7 @@ mod tests {
let query = query.retrieved_documents(documents.clone());
assert_eq!(query.documents(), &documents);
assert_eq!(query.history().len(), 1);
assert!(query.current().is_empty());
if let TransformationEvent::Retrieved {
before,
after,
Expand Down

0 comments on commit 8a1cc69

Please sign in to comment.