Compare commits

...
Author SHA1 Message Date
Petar Petrov b1cc32d50e Batch entity state updates per websocket frame
Pass batchUpdates to the entity states subscription, so all state
messages of one websocket frame build one states map and one hass
update. core.ts creates the collection, so it passes the option too.
Needs the batchUpdates option from
home-assistant/home-assistant-js-websocket#820.
2026-12-02 12:57:20 +02:00
2 changed files with 4 additions and 2 deletions

No files matched your search

+1 -1
View File
@@ -177,7 +177,7 @@ window.hassConnection.then(({ conn }) => {
const noop = () => {
// do nothing
};
subscribeEntities(conn, noop);
subscribeEntities(conn, noop, { batchUpdates: true });
subscribeEntityRegistryDisplay(conn, noop);
subscribeDeviceRegistry(conn, noop);
subscribeAreaRegistry(conn, noop);
+3 -1
View File
@@ -273,7 +273,9 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
}
});
subscribeEntities(conn, (states) => this._updateHass({ states }));
subscribeEntities(conn, (states) => this._updateHass({ states }), {
batchUpdates: true,
});
// A refetch returns new objects for every entry. Putting the unchanged
// previous ones back into the store's list keeps one copy, shared with
// `hass`.