Remove unneeded close dialog calls

fix-navigate-dialog-close-timing
Bram Kragten 2024-12-12 09:31:08 +01:00
parent 93947d76a2
commit a8b8fb4c30
4 changed files with 6 additions and 39 deletions

View File

@ -164,7 +164,6 @@ export class HaRelatedItems extends LitElement {
return html`
<a
href=${`/config/integrations/integration/${entry.domain}#config_entry=${entry.entry_id}`}
@click=${this._navigateAwayClose}
>
<ha-list-item hasMeta graphic="icon">
<img
@ -191,7 +190,6 @@ export class HaRelatedItems extends LitElement {
(integration) =>
html`<a
href=${`/config/integrations/integration/${integration}`}
@click=${this._navigateAwayClose}
>
<ha-list-item hasMeta graphic="icon">
<img
@ -223,10 +221,7 @@ export class HaRelatedItems extends LitElement {
return nothing;
}
return html`
<a
href="/config/devices/device/${relatedDeviceId}"
@click=${this._navigateAwayClose}
>
<a href="/config/devices/device/${relatedDeviceId}">
<ha-list-item hasMeta graphic="icon">
<ha-svg-icon
.path=${mdiDevices}
@ -251,10 +246,7 @@ export class HaRelatedItems extends LitElement {
return nothing;
}
return html`
<a
href="/config/areas/area/${relatedAreaId}"
@click=${this._navigateAwayClose}
>
<a href="/config/areas/area/${relatedAreaId}">
<ha-list-item
hasMeta
.graphic=${area.picture ? "avatar" : "icon"}
@ -364,10 +356,7 @@ export class HaRelatedItems extends LitElement {
const blueprintMeta = this._blueprints
? this._blueprints.automation[path]
: undefined;
return html`<a
href="/config/blueprint/dashboard"
@click=${this._navigateAwayClose}
>
return html`<a href="/config/blueprint/dashboard">
<ha-list-item hasMeta graphic="icon">
<ha-svg-icon
.path=${mdiPaletteSwatch}
@ -421,10 +410,7 @@ export class HaRelatedItems extends LitElement {
const blueprintMeta = this._blueprints
? this._blueprints.script[path]
: undefined;
return html`<a
href="/config/blueprint/dashboard"
@click=${this._navigateAwayClose}
>
return html`<a href="/config/blueprint/dashboard">
<ha-list-item hasMeta graphic="icon">
<ha-svg-icon
.path=${mdiPaletteSwatch}
@ -468,14 +454,6 @@ export class HaRelatedItems extends LitElement {
`;
}
private async _navigateAwayClose() {
// allow new page to open before closing dialog
await new Promise((resolve) => {
setTimeout(resolve, 0);
});
fireEvent(this, "close-dialog");
}
private async _findRelated() {
this._related = await findRelated(this.hass, this.itemType, this.itemId);
if (this._related.config_entry) {

View File

@ -3,7 +3,6 @@ import type { PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { fireEvent } from "../../common/dom/fire_event";
import { computeDomain } from "../../common/entity/compute_domain";
import { createSearchParam } from "../../common/url/search-params";
import type { ChartResizeOptions } from "../../components/chart/ha-chart-base";
@ -77,7 +76,7 @@ export class MoreInfoHistory extends LitElement {
</div>
${__DEMO__
? nothing
: html`<a href=${this._showMoreHref} @click=${this._close}
: html`<a href=${this._showMoreHref}
>${this.hass.localize(
"ui.dialogs.more_info_control.show_more"
)}</a
@ -244,10 +243,6 @@ export class MoreInfoHistory extends LitElement {
this._setRedrawTimer();
}
private _close(): void {
setTimeout(() => fireEvent(this, "close-dialog"), 500);
}
static styles = css`
.header {
display: flex;

View File

@ -4,7 +4,6 @@ import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { fireEvent } from "../../common/dom/fire_event";
import { createSearchParam } from "../../common/url/search-params";
import "../../panels/logbook/ha-logbook";
import type { HomeAssistant } from "../../types";
@ -36,7 +35,7 @@ export class MoreInfoLogbook extends LitElement {
<div class="title">
${this.hass.localize("ui.dialogs.more_info_control.logbook")}
</div>
<a href=${this._showMoreHref} @click=${this._close}
<a href=${this._showMoreHref}
>${this.hass.localize("ui.dialogs.more_info_control.show_more")}</a
>
</div>
@ -67,10 +66,6 @@ export class MoreInfoLogbook extends LitElement {
}
}
private _close(): void {
setTimeout(() => fireEvent(this, "close-dialog"), 500);
}
static get styles() {
return [
css`

View File

@ -237,7 +237,6 @@ class HaDomainIntegrations extends LitElement {
["cloud", "google_assistant", "alexa"].includes(domain) &&
isComponentLoaded(this.hass, "cloud")
) {
fireEvent(this, "close-dialog");
navigate("/config/cloud");
return;
}