From 2e4d15611de1a0d249ca7777e7b7f7a8627ff5e0 Mon Sep 17 00:00:00 2001 From: slumtrimpet Date: Thu, 11 Feb 2021 11:45:52 -0500 Subject: [PATCH] BUG FIX: searchpre + empty string failure A bug exists currently where users can no longer search for an empty string ('') when searchPre is implemented. Need to explicitly compare the searchPre return to false instead of trusting the ! operator on the string itself as sometimes '' is desired. --- src/main.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 908779a..f1407cf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -365,7 +365,8 @@ export class AutoComplete { // custom handler may change newValue if (this._settings.events.searchPre !== null) { const newValue: string = this._settings.events.searchPre(this._searchText, this._$el); - if (!newValue) + // only punt if we explicitely request it, otherwise allow search for '' + if (newValue === false) return; this._searchText = newValue; }