mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Fix dialog navigation by making navigate()
async
This commit is contained in:
parent
e4fc21c991
commit
142e674020
@ -16,6 +16,7 @@ export interface NavigateOptions {
|
|||||||
export const navigate = (path: string, options?: NavigateOptions) => {
|
export const navigate = (path: string, options?: NavigateOptions) => {
|
||||||
const replace = options?.replace || false;
|
const replace = options?.replace || false;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
if (__DEMO__) {
|
if (__DEMO__) {
|
||||||
if (replace) {
|
if (replace) {
|
||||||
mainWindow.history.replaceState(
|
mainWindow.history.replaceState(
|
||||||
@ -30,7 +31,9 @@ export const navigate = (path: string, options?: NavigateOptions) => {
|
|||||||
}
|
}
|
||||||
} else if (replace) {
|
} else if (replace) {
|
||||||
mainWindow.history.replaceState(
|
mainWindow.history.replaceState(
|
||||||
mainWindow.history.state?.root ? { root: true } : (options?.data ?? null),
|
mainWindow.history.state?.root
|
||||||
|
? { root: true }
|
||||||
|
: (options?.data ?? null),
|
||||||
"",
|
"",
|
||||||
path
|
path
|
||||||
);
|
);
|
||||||
@ -40,4 +43,5 @@ export const navigate = (path: string, options?: NavigateOptions) => {
|
|||||||
fireEvent(mainWindow, "location-changed", {
|
fireEvent(mainWindow, "location-changed", {
|
||||||
replace,
|
replace,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user