Use top.history in dialogs and navigate (#8995)

This commit is contained in:
Joakim Sørensen
2021-04-26 16:41:30 +02:00
committed by GitHub
parent b8d6b1ebdd
commit 4d287a1f83
4 changed files with 30 additions and 23 deletions

View File

@@ -61,25 +61,25 @@ export const showDialog = async (
}
if (addHistory) {
history.replaceState(
top.history.replaceState(
{
dialog: dialogTag,
open: false,
oldState:
history.state?.open && history.state?.dialog !== dialogTag
? history.state
top.history.state?.open && top.history.state?.dialog !== dialogTag
? top.history.state
: null,
},
""
);
try {
history.pushState(
top.history.pushState(
{ dialog: dialogTag, dialogParams: dialogParams, open: true },
""
);
} catch (err) {
// dialogParams could not be cloned, probably contains callback
history.pushState(
top.history.pushState(
{ dialog: dialogTag, dialogParams: null, open: true },
""
);
@@ -90,7 +90,7 @@ export const showDialog = async (
};
export const replaceDialog = () => {
history.replaceState({ ...history.state, replaced: true }, "");
top.history.replaceState({ ...top.history.state, replaced: true }, "");
};
export const closeDialog = async (dialogTag: string): Promise<boolean> => {