From cf85ee4ea73985529a16321d671d893ddb862439 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 22 Feb 2024 09:33:38 -0500 Subject: fixed search to update after typing delay. fixed collection of tags to set container for embeddings --- src/client/views/search/SearchBox.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 0b664beaa..9f153e86d 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -88,9 +88,11 @@ export class SearchBox extends ViewBoxBaseComponent() { * (Note: There is no longer a need to press enter to submit a search. Any update to the input * causes a search to be submitted automatically.) */ + _timeout: any = undefined; onInputChange = action((e: React.ChangeEvent) => { this._searchString = e.target.value; - this.submitSearch(); + this._timeout && clearTimeout(this._timeout); + this._timeout = setTimeout(() => this.submitSearch(), 300); }); /** @@ -334,6 +336,8 @@ export class SearchBox extends ViewBoxBaseComponent() { * brushes and highlights. All search matches are cleared as well. */ resetSearch = action(() => { + this._timeout && clearTimeout(this._timeout); + this._timeout = undefined; this._results.forEach((_, doc) => { DocumentManager.Instance.getFirstDocumentView(doc)?.ComponentView?.search?.('', undefined, true); Doc.UnBrushDoc(doc); @@ -436,10 +440,10 @@ export class SearchBox extends ViewBoxBaseComponent() { )} { + onKeyDown={e => { e.key === 'Enter' ? this.submitSearch() : null; e.stopPropagation(); }} -- cgit v1.2.3-70-g09d2