From: Matthias Schmidt Date: Sun, 17 Jan 2021 12:41:08 +0000 (+0100) Subject: Fix hiding suggestion dropdown when no suggestion are available X-Git-Tag: 5.4.0_Alpha_1~432 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=926f0404263dfb5b360f34d79f47661c23481509;p=GitHub%2FWoltLab%2FWCF.git Fix hiding suggestion dropdown when no suggestion are available See 0a9081c855bf8b9ab0ffbd5ab98679a11f23849c --- diff --git a/ts/WoltLabSuite/Core/Ui/Suggestion.ts b/ts/WoltLabSuite/Core/Ui/Suggestion.ts index 177572f90f..ce49342397 100644 --- a/ts/WoltLabSuite/Core/Ui/Suggestion.ts +++ b/ts/WoltLabSuite/Core/Ui/Suggestion.ts @@ -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) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Suggestion.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Suggestion.js index 052f5f8bf3..d71465882f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Suggestion.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Suggestion.js @@ -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) {