From 0979b4d0dcfbbfb631a6e6148a037054335d9415 Mon Sep 17 00:00:00 2001 From: Tim Stibbs Date: Wed, 4 Oct 2023 21:53:38 +0100 Subject: [PATCH] fix: clear results list when pressing enter (#372) Fixes #371. Co-authored-by: Stephan Meijer --- src/SearchControl.ts | 1 + src/resultList.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SearchControl.ts b/src/SearchControl.ts index d26afc2f8..d7bda9292 100644 --- a/src/SearchControl.ts +++ b/src/SearchControl.ts @@ -382,6 +382,7 @@ const Control: SearchControl = { }, async onSubmit(query) { + this.resultList.clear(); const { provider } = this.options; const results = await provider!.search(query); diff --git a/src/resultList.ts b/src/resultList.ts index 320f035a7..09f78e3fa 100644 --- a/src/resultList.ts +++ b/src/resultList.ts @@ -110,7 +110,6 @@ export default class ResultList { } const idx = Number(target.getAttribute('data-key')); - this.clear(); this.handleClick({ result: this.results[idx] }); }; }