20250531.3 (#25764)

This commit is contained in:
Paul Bottein 2025-06-12 14:23:03 +02:00 committed by GitHub
commit de42714505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 47 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20250531.2" version = "20250531.3"
license = "Apache-2.0" license = "Apache-2.0"
license-files = ["LICENSE*"] license-files = ["LICENSE*"]
description = "The Home Assistant frontend" description = "The Home Assistant frontend"

View File

@ -339,7 +339,7 @@ export const computeBackupSize = (backup: BackupContent) =>
export type BackupType = "automatic" | "manual" | "addon_update"; export type BackupType = "automatic" | "manual" | "addon_update";
const BACKUP_TYPE_ORDER: BackupType[] = ["automatic", "manual", "addon_update"]; const BACKUP_TYPE_ORDER: BackupType[] = ["automatic", "addon_update", "manual"];
export const getBackupTypes = memoize((isHassio: boolean) => export const getBackupTypes = memoize((isHassio: boolean) =>
isHassio isHassio

View File

@ -127,16 +127,15 @@ export class HaConfigDevicePage extends LitElement {
@state() private _related?: RelatedResult; @state() private _related?: RelatedResult;
// If a number, it's the request ID so we make sure we don't show older info @state() private _diagnosticDownloadLinks: DeviceAction[] = [];
@state() private _diagnosticDownloadLinks?: number | DeviceAction[];
@state() private _deleteButtons?: DeviceAction[]; @state() private _deleteButtons: DeviceAction[] = [];
@state() private _deviceActions?: DeviceAction[]; @state() private _deviceActions: DeviceAction[] = [];
@state() private _deviceAlerts?: DeviceAlert[]; @state() private _deviceAlerts: DeviceAlert[] = [];
private _deviceAlertsTimeout?: number; private _deviceAlertsActionsTimeout?: number;
@state() @state()
@consume({ context: fullEntitiesContext, subscribe: true }) @consume({ context: fullEntitiesContext, subscribe: true })
@ -255,42 +254,19 @@ export class HaConfigDevicePage extends LitElement {
public willUpdate(changedProps) { public willUpdate(changedProps) {
super.willUpdate(changedProps); super.willUpdate(changedProps);
if ( if (changedProps.has("deviceId") || changedProps.has("entries")) {
changedProps.has("deviceId") || this._deviceActions = [];
changedProps.has("devices") || this._deviceAlerts = [];
changedProps.has("entries") this._deleteButtons = [];
) { this._diagnosticDownloadLinks = [];
this._diagnosticDownloadLinks = undefined; this._fetchData();
this._deleteButtons = undefined;
this._deviceActions = undefined;
this._deviceAlerts = undefined;
} }
if (
(this._diagnosticDownloadLinks &&
this._deleteButtons &&
this._deviceActions &&
this._deviceAlerts) ||
!this.deviceId ||
!this.entries
) {
return;
}
this._diagnosticDownloadLinks = Math.random();
this._deleteButtons = []; // To prevent re-rendering if no delete buttons
this._deviceActions = [];
this._deviceAlerts = [];
this._getDiagnosticButtons(this._diagnosticDownloadLinks);
this._getDeleteActions();
this._getDeviceActions();
clearTimeout(this._deviceAlertsTimeout);
this._getDeviceAlerts();
} }
protected firstUpdated(changedProps) { protected firstUpdated(changedProps) {
super.firstUpdated(changedProps); super.firstUpdated(changedProps);
loadDeviceRegistryDetailDialog(); loadDeviceRegistryDetailDialog();
this._fetchData();
} }
protected updated(changedProps) { protected updated(changedProps) {
@ -302,7 +278,7 @@ export class HaConfigDevicePage extends LitElement {
public disconnectedCallback() { public disconnectedCallback() {
super.disconnectedCallback(); super.disconnectedCallback();
clearTimeout(this._deviceAlertsTimeout); clearTimeout(this._deviceAlertsActionsTimeout);
} }
protected render() { protected render() {
@ -909,7 +885,18 @@ export class HaConfigDevicePage extends LitElement {
</hass-subpage>`; </hass-subpage>`;
} }
private async _getDiagnosticButtons(requestId: number): Promise<void> { private _fetchData() {
if (this.deviceId && this.entries.length) {
this._getDiagnosticButtons();
this._getDeleteActions();
clearTimeout(this._deviceAlertsActionsTimeout);
this._getDeviceActions();
this._getDeviceAlerts();
}
}
private async _getDiagnosticButtons(): Promise<void> {
const deviceId = this.deviceId;
if (!isComponentLoaded(this.hass, "diagnostics")) { if (!isComponentLoaded(this.hass, "diagnostics")) {
return; return;
} }
@ -951,7 +938,8 @@ export class HaConfigDevicePage extends LitElement {
links = links.filter(Boolean); links = links.filter(Boolean);
if (this._diagnosticDownloadLinks !== requestId) { if (this.deviceId !== deviceId) {
// abort if the device has changed
return; return;
} }
if (links.length > 0) { if (links.length > 0) {
@ -1176,12 +1164,12 @@ export class HaConfigDevicePage extends LitElement {
deviceAlerts.push(...alerts); deviceAlerts.push(...alerts);
} }
this._deviceAlerts = deviceAlerts;
if (deviceAlerts.length) { if (deviceAlerts.length) {
this._deviceAlerts = deviceAlerts; this._deviceAlertsActionsTimeout = window.setTimeout(() => {
this._deviceAlertsTimeout = window.setTimeout( this._getDeviceAlerts();
() => this._getDeviceAlerts(), this._getDeviceActions();
DEVICE_ALERTS_INTERVAL }, DEVICE_ALERTS_INTERVAL);
);
} }
} }

View File

@ -96,7 +96,9 @@ export class HuiCard extends ReactiveElement {
if (!this._element) return {}; if (!this._element) return {};
if (this._element.getGridOptions) { if (this._element.getGridOptions) {
return this._element.getGridOptions(); const options = this._element.getGridOptions();
// Some custom cards might return undefined, so we ensure we return an object
return options || {};
} }
if (this._element.getLayoutOptions) { if (this._element.getLayoutOptions) {
// Disabled for now to avoid spamming the console, need to be re-enabled when hui-card performance are fixed // Disabled for now to avoid spamming the console, need to be re-enabled when hui-card performance are fixed