From 2d0f527dd1fac97c0f6448d9682b26b3c873b966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boros=20Ma=CC=81te=CC=81?= <33902750+qwadrox@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:41:33 +0100 Subject: [PATCH 1/2] fix: add showEmptyMessage condition --- packages/primeng/src/autocomplete/autocomplete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/primeng/src/autocomplete/autocomplete.ts b/packages/primeng/src/autocomplete/autocomplete.ts index 537302115d2..e5c26216a9d 100755 --- a/packages/primeng/src/autocomplete/autocomplete.ts +++ b/packages/primeng/src/autocomplete/autocomplete.ts @@ -1057,7 +1057,7 @@ export class AutoComplete extends BaseComponent implements AfterViewChecked, Aft handleSuggestionsChange() { if (this.loading) { - this._suggestions()?.length > 0 ? this.show() : !!this.emptyTemplate ? this.show() : this.hide(); + this._suggestions().length > 0 || this.showEmptyMessage || !!this.emptyTemplate ? this.show() : this.hide(); const focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; this.focusedOptionIndex.set(focusedOptionIndex); this.suggestionsUpdated = true; From 1cdebbf0ae3568f16d167f147d54a049bc7e07a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boros=20Ma=CC=81te=CC=81?= <33902750+qwadrox@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:44:09 +0100 Subject: [PATCH 2/2] safely check suggestions length --- packages/primeng/src/autocomplete/autocomplete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/primeng/src/autocomplete/autocomplete.ts b/packages/primeng/src/autocomplete/autocomplete.ts index e5c26216a9d..3be0ff89e16 100755 --- a/packages/primeng/src/autocomplete/autocomplete.ts +++ b/packages/primeng/src/autocomplete/autocomplete.ts @@ -1057,7 +1057,7 @@ export class AutoComplete extends BaseComponent implements AfterViewChecked, Aft handleSuggestionsChange() { if (this.loading) { - this._suggestions().length > 0 || this.showEmptyMessage || !!this.emptyTemplate ? this.show() : this.hide(); + this._suggestions()?.length > 0 || this.showEmptyMessage || !!this.emptyTemplate ? this.show() : this.hide(); const focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; this.focusedOptionIndex.set(focusedOptionIndex); this.suggestionsUpdated = true;