From d62fff6ce42e502713ec5590065bf1c1b0380998 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Mon, 24 Oct 2022 22:06:07 +0200 Subject: [PATCH] Fixed a freeze caused by an empty string in Query object --- src/search/query.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/search/query.ts b/src/search/query.ts index 389436d..d632464 100644 --- a/src/search/query.ts +++ b/src/search/query.ts @@ -27,7 +27,13 @@ export class Query { this.exclusions = tokens.exclude.text .map(this.formatToken) .filter(o => !!o.value) - this.segments = tokens.text.map(this.formatToken) + this.segments = tokens.text.reduce((prev, curr) => { + const formatted = this.formatToken(curr) + if (formatted.value) { + prev.push(formatted) + } + return prev + }, []) } public segmentsToStr(): string {