mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Fix dirty check/leaving automation editor (#10211)
This commit is contained in:
parent
b157cf5294
commit
5be475ea17
@ -443,7 +443,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
),
|
||||
confirmText: this.hass!.localize("ui.common.leave"),
|
||||
dismissText: this.hass!.localize("ui.common.stay"),
|
||||
confirm: () => history.back(),
|
||||
confirm: () => {
|
||||
setTimeout(() => history.back());
|
||||
},
|
||||
});
|
||||
} else {
|
||||
history.back();
|
||||
|
@ -267,7 +267,10 @@ export class HaManualAutomationEditor extends LitElement {
|
||||
const mode = ((ev.target as PaperListboxElement)?.selectedItem as any)
|
||||
?.mode;
|
||||
|
||||
if (mode === this.config!.mode) {
|
||||
if (
|
||||
mode === this.config!.mode ||
|
||||
(!this.config!.mode && mode === MODES[0])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const value = {
|
||||
|
@ -263,7 +263,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
||||
|
||||
private _idChanged(ev: CustomEvent) {
|
||||
const newId = ev.detail.value;
|
||||
if (newId === this.trigger.id) {
|
||||
if (newId === (this.trigger.id ?? "")) {
|
||||
return;
|
||||
}
|
||||
const value = { ...this.trigger };
|
||||
|
@ -555,7 +555,7 @@ export class HaSceneEditor extends SubscribeMixin(
|
||||
try {
|
||||
config = await getSceneConfig(this.hass, this.sceneId!);
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
await showAlertDialog(this, {
|
||||
text:
|
||||
err.status_code === 404
|
||||
? this.hass.localize(
|
||||
@ -566,7 +566,8 @@ export class HaSceneEditor extends SubscribeMixin(
|
||||
"err_no",
|
||||
err.status_code
|
||||
),
|
||||
}).then(() => history.back());
|
||||
});
|
||||
history.back();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
),
|
||||
confirmText: this.hass!.localize("ui.common.leave"),
|
||||
dismissText: this.hass!.localize("ui.common.stay"),
|
||||
confirm: () => history.back(),
|
||||
confirm: () => {
|
||||
setTimeout(() => history.back());
|
||||
},
|
||||
});
|
||||
} else {
|
||||
history.back();
|
||||
|
Loading…
x
Reference in New Issue
Block a user