Fix hiding suggestion dropdown when no suggestion are available
authorMatthias Schmidt <gravatronics@live.com>
Sun, 17 Jan 2021 12:41:08 +0000 (13:41 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 17 Jan 2021 12:41:08 +0000 (13:41 +0100)
See 0a9081c855bf8b9ab0ffbd5ab98679a11f23849c

ts/WoltLabSuite/Core/Ui/Suggestion.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Suggestion.js

index 177572f90f35c448d0a582d902be1aedeb4ce383..ce49342397a0a52990311d3d3b9acddf202f82b3 100644 (file)
@@ -218,7 +218,7 @@ class UiSuggestion implements AjaxCallbackObject {
       this.dropdownMenu.innerHTML = "";
     }
 
-    if (Array.isArray(data.returnValues)) {
+    if (Array.isArray(data.returnValues) && data.returnValues.length > 0) {
       data.returnValues.forEach((item, index) => {
         const anchor = document.createElement("a");
         if (item.icon) {
index 052f5f8bf3a301791991ca853a65245a25bc8b27..d71465882f3924b74d2cbbfdee62ae835c4297b2 100644 (file)
@@ -169,7 +169,7 @@ define(["require", "exports", "tslib", "../Ajax", "../Core", "./Dropdown/Simple"
             else {
                 this.dropdownMenu.innerHTML = "";
             }
-            if (Array.isArray(data.returnValues)) {
+            if (Array.isArray(data.returnValues) && data.returnValues.length > 0) {
                 data.returnValues.forEach((item, index) => {
                     const anchor = document.createElement("a");
                     if (item.icon) {