Skip to content

Commit 5c2ee54

Browse files
authored
Fix target picker with empty sections (#27813)
1 parent 1dfca76 commit 5c2ee54

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/target-picker/ha-target-picker-selector.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ export class HaTargetPickerSelector extends LitElement {
705705
) as EntityComboBoxItem[];
706706
}
707707

708-
if (!filterType) {
708+
if (!filterType && entities.length) {
709709
// show group title
710710
items.push(
711711
this.hass.localize("ui.components.target-picker.type.entities")
@@ -733,7 +733,7 @@ export class HaTargetPickerSelector extends LitElement {
733733
devices = this._filterGroup("device", devices);
734734
}
735735

736-
if (!filterType) {
736+
if (!filterType && devices.length) {
737737
// show group title
738738
items.push(
739739
this.hass.localize("ui.components.target-picker.type.devices")
@@ -769,7 +769,7 @@ export class HaTargetPickerSelector extends LitElement {
769769
) as FloorComboBoxItem[];
770770
}
771771

772-
if (!filterType) {
772+
if (!filterType && areasAndFloors.length) {
773773
// show group title
774774
items.push(
775775
this.hass.localize("ui.components.target-picker.type.areas")
@@ -811,7 +811,7 @@ export class HaTargetPickerSelector extends LitElement {
811811
labels = this._filterGroup("label", labels);
812812
}
813813

814-
if (!filterType) {
814+
if (!filterType && labels.length) {
815815
// show group title
816816
items.push(
817817
this.hass.localize("ui.components.target-picker.type.labels")

0 commit comments

Comments
 (0)