Restore alphabetical sorting to Areas (#19897)

This commit is contained in:
karwosts 2024-02-28 05:37:02 -05:00 committed by GitHub
parent f4c932ef9c
commit ccdd906e2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,17 @@
import { Connection, createCollection } from "home-assistant-js-websocket";
import { Store } from "home-assistant-js-websocket/dist/store";
import { stringCompare } from "../common/string/compare";
import { debounce } from "../common/util/debounce";
import { AreaRegistryEntry } from "./area_registry";
const fetchAreaRegistry = (conn: Connection) =>
conn.sendMessagePromise<AreaRegistryEntry[]>({
type: "config/area_registry/list",
});
conn
.sendMessagePromise<AreaRegistryEntry[]>({
type: "config/area_registry/list",
})
.then((areas) =>
areas.sort((ent1, ent2) => stringCompare(ent1.name, ent2.name))
);
const subscribeAreaRegistryUpdates = (
conn: Connection,