This commit is contained in:
Petar Petrov
2024-12-11 13:59:47 +02:00
parent 48f5d17060
commit a6cbbfe1a4
2 changed files with 53 additions and 39 deletions

View File

@@ -171,11 +171,21 @@ export const closeLastDialog = async () => {
""
);
}
return closed;
}
return true;
};
export const closeAllDialogs = () =>
Promise.all(OPEN_DIALOG_STACK.map((state) => closeDialog(state.dialogTag)));
export const closeAllDialogs = async () => {
while (OPEN_DIALOG_STACK.length) {
// eslint-disable-next-line no-await-in-loop
const closed = await closeLastDialog();
if (!closed) {
return false;
}
}
return true;
};
const _handleClosed = async (ev: HASSDomEvent<DialogClosedParams>) => {
// If not closed by navigating back, remove the open state from history