mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Adds throttler to config pages for state entity updates (#21646)
throttler
This commit is contained in:
parent
6b99cda982
commit
00eb820e36
@ -51,6 +51,7 @@ import { SubscribeMixin } from "../../mixins/subscribe-mixin";
|
||||
import { HomeAssistant, Route } from "../../types";
|
||||
import { subscribeLabelRegistry } from "../../data/label_registry";
|
||||
import { subscribeFloorRegistry } from "../../data/floor_registry";
|
||||
import { throttle } from "../../common/util/throttle";
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
@ -395,6 +396,10 @@ class HaPanelConfig extends SubscribeMixin(HassRouterPage) {
|
||||
initialValue: [],
|
||||
});
|
||||
|
||||
private _hassThrottler = throttle((el, hass) => {
|
||||
el.hass = hass;
|
||||
}, 1000);
|
||||
|
||||
public hassSubscribe(): UnsubscribeFunc[] {
|
||||
return [
|
||||
subscribeEntityRegistry(this.hass.connection!, (entities) => {
|
||||
@ -641,7 +646,11 @@ class HaPanelConfig extends SubscribeMixin(HassRouterPage) {
|
||||
this.hass.dockedSidebar === "docked" ? this._wideSidebar : this._wide;
|
||||
|
||||
el.route = this.routeTail;
|
||||
el.hass = this.hass;
|
||||
if (el.hass !== undefined) {
|
||||
this._hassThrottler(el, this.hass);
|
||||
} else {
|
||||
el.hass = this.hass;
|
||||
}
|
||||
el.showAdvanced = Boolean(this.hass.userData?.showAdvanced);
|
||||
el.isWide = isWide;
|
||||
el.narrow = this.narrow;
|
||||
|
Loading…
x
Reference in New Issue
Block a user