clean results on query update

This commit is contained in:
Nikita Galaiko 2023-03-17 14:43:21 +01:00
parent fa06ec611d
commit db9eccc5d5
2 changed files with 11 additions and 10 deletions

View File

@ -1,17 +1,17 @@
import { invoke } from '@tauri-apps/api'; import { invoke } from '@tauri-apps/api';
export type SearchResult = { export type SearchResult = {
projectId: string; projectId: string;
sessionId: string; sessionId: string;
filePath: string; filePath: string;
// index of the delta in the session. // index of the delta in the session.
index: number; index: number;
highlighted: string[]; // contains the highlighted text highlighted: string[]; // contains the highlighted text
}; };
export const search = (params: { export const search = (params: {
projectId: string; projectId: string;
query: string; query: string;
limit?: number; limit?: number;
offset?: number; offset?: number;
}) => invoke<SearchResult[]>('search', params); }) => invoke<SearchResult[]>('search', params);

View File

@ -21,6 +21,7 @@
$: { $: {
stopProcessing = true; stopProcessing = true;
processedResults = [];
if ($searchTerm) { if ($searchTerm) {
fetchResults($project?.id ?? '', $searchTerm); fetchResults($project?.id ?? '', $searchTerm);
} }