mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
log warning when navigation is blocked
This commit is contained in:
parent
c713106948
commit
48f5d17060
@ -21,8 +21,9 @@ export const navigate = async (path: string, options?: NavigateOptions) => {
|
|||||||
if (history.state?.dialog) {
|
if (history.state?.dialog) {
|
||||||
const closed = await closeAllDialogs();
|
const closed = await closeAllDialogs();
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
// block navigation if dialogs refuse to close
|
// eslint-disable-next-line no-console
|
||||||
return;
|
console.warn("Navigation blocked, because dialog refused to close");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// if there were open dialogs, we discard the current state
|
// if there were open dialogs, we discard the current state
|
||||||
replace = true;
|
replace = true;
|
||||||
@ -50,4 +51,5 @@ export const navigate = async (path: string, options?: NavigateOptions) => {
|
|||||||
fireEvent(mainWindow, "location-changed", {
|
fireEvent(mainWindow, "location-changed", {
|
||||||
replace,
|
replace,
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user