Fix dialog navigation by making navigate() async

This commit is contained in:
Petar Petrov 2024-12-11 11:56:32 +02:00
parent e4fc21c991
commit 142e674020

View File

@ -16,6 +16,7 @@ export interface NavigateOptions {
export const navigate = (path: string, options?: NavigateOptions) => {
const replace = options?.replace || false;
setTimeout(() => {
if (__DEMO__) {
if (replace) {
mainWindow.history.replaceState(
@ -30,7 +31,9 @@ export const navigate = (path: string, options?: NavigateOptions) => {
}
} else if (replace) {
mainWindow.history.replaceState(
mainWindow.history.state?.root ? { root: true } : (options?.data ?? null),
mainWindow.history.state?.root
? { root: true }
: (options?.data ?? null),
"",
path
);
@ -40,4 +43,5 @@ export const navigate = (path: string, options?: NavigateOptions) => {
fireEvent(mainWindow, "location-changed", {
replace,
});
});
};