Fixed a glitch that displayed the previous results when the query field was empty
This commit is contained in:
@@ -36,6 +36,10 @@ export class Query {
|
||||
}, [])
|
||||
}
|
||||
|
||||
public isEmpty(): boolean {
|
||||
return this.segments.length === 0
|
||||
}
|
||||
|
||||
public segmentsToStr(): string {
|
||||
return this.segments.map(({ value }) => value).join(' ')
|
||||
}
|
||||
|
||||
@@ -190,6 +190,10 @@ export class SearchEngine {
|
||||
query: Query,
|
||||
options?: Partial<{ singleFilePath: string | null }>
|
||||
): Promise<ResultNote[]> {
|
||||
if (query.isEmpty()) {
|
||||
previousResults = []
|
||||
return []
|
||||
}
|
||||
// Get the raw results
|
||||
let results: SearchResult[]
|
||||
if (settings.simpleSearch) {
|
||||
|
||||
Reference in New Issue
Block a user