log warning when navigation is blocked

This commit is contained in:
Petar Petrov 2024-12-11 13:36:47 +02:00
parent c713106948
commit 48f5d17060

View File

@ -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;
}; };