mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-10 11:30:01 +00:00
Use empty string for no name instead of empty array for name
This commit is contained in:
@@ -288,7 +288,10 @@ export class HaEntityNamePicker extends LitElement {
|
|||||||
|
|
||||||
private _toItems = memoizeOne((value?: typeof this.value) => {
|
private _toItems = memoizeOne((value?: typeof this.value) => {
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
return [{ type: "text", text: value } as const];
|
if (value === "") {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [{ type: "text", text: value } satisfies EntityNameItem];
|
||||||
}
|
}
|
||||||
return value ? ensureArray(value) : [];
|
return value ? ensureArray(value) : [];
|
||||||
});
|
});
|
||||||
@@ -296,7 +299,7 @@ export class HaEntityNamePicker extends LitElement {
|
|||||||
private _toValue = memoizeOne(
|
private _toValue = memoizeOne(
|
||||||
(items: EntityNameItem[]): typeof this.value => {
|
(items: EntityNameItem[]): typeof this.value => {
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return [];
|
return "";
|
||||||
}
|
}
|
||||||
if (items.length === 1) {
|
if (items.length === 1) {
|
||||||
const item = items[0];
|
const item = items[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user