From eadc8fa1935e6d3088732a44d043ace6e41a572d Mon Sep 17 00:00:00 2001
From: Alexandre Iooss <erdnaxe@crans.org>
Date: Mon, 10 Aug 2020 14:45:44 +0200
Subject: [PATCH] Fix autocompletion not showing up in rare cases

---
 note_kfet/static/js/base.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/note_kfet/static/js/base.js b/note_kfet/static/js/base.js
index 6473a037..9db1d958 100644
--- a/note_kfet/static/js/base.js
+++ b/note_kfet/static/js/base.js
@@ -213,15 +213,16 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
         fallbackPlacement: 'clockwise'
     });
 
+    let old_pattern = null;
+
     // Clear search on click
     field.click(function () {
         field.tooltip('hide');
         field.removeClass('is-invalid');
         field.val("");
+        old_pattern = "";
     });
 
-    let old_pattern = null;
-
     // When the user type "Enter", the first alias is clicked
     field.keypress(function (event) {
         if (event.originalEvent.charCode === 13 && notes.length > 0) {
-- 
GitLab