mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fix new automation dialog in Firefox (#23319)
This commit is contained in:
parent
2718801c69
commit
48819a59e7
@ -23,10 +23,13 @@ export const navigate = async (path: string, options?: NavigateOptions) => {
|
|||||||
console.warn("Navigation blocked, because dialog refused to close");
|
console.warn("Navigation blocked, because dialog refused to close");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return new Promise<boolean>((resolve) => {
|
return new Promise<boolean>((resolve) => {
|
||||||
// need to wait for history state to be updated in case a dialog was closed
|
// need to wait for history state to be updated in case a dialog was closed
|
||||||
setTimeout(async () => {
|
setTimeout(() => {
|
||||||
|
navigate(path, options).then(resolve);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
const replace = options?.replace || false;
|
const replace = options?.replace || false;
|
||||||
|
|
||||||
if (__DEMO__) {
|
if (__DEMO__) {
|
||||||
@ -51,7 +54,5 @@ export const navigate = async (path: string, options?: NavigateOptions) => {
|
|||||||
fireEvent(mainWindow, "location-changed", {
|
fireEvent(mainWindow, "location-changed", {
|
||||||
replace,
|
replace,
|
||||||
});
|
});
|
||||||
resolve(true);
|
return true;
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
@ -205,7 +205,6 @@ class DialogNewAutomation extends LitElement implements HassDialog {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const path = (ev.currentTarget! as any).path;
|
const path = (ev.currentTarget! as any).path;
|
||||||
this.closeDialog();
|
|
||||||
if (this._mode === "script") {
|
if (this._mode === "script") {
|
||||||
showScriptEditor({ use_blueprint: { path } });
|
showScriptEditor({ use_blueprint: { path } });
|
||||||
} else {
|
} else {
|
||||||
@ -217,7 +216,6 @@ class DialogNewAutomation extends LitElement implements HassDialog {
|
|||||||
if (!shouldHandleRequestSelectedEvent(ev)) {
|
if (!shouldHandleRequestSelectedEvent(ev)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.closeDialog();
|
|
||||||
if (this._mode === "script") {
|
if (this._mode === "script") {
|
||||||
showScriptEditor();
|
showScriptEditor();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user