mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Fix navigation from stacked dialogs with the same name (#23698)
* Fix navigation from stacked dialogs * lint fix * Keep only 1 instance per dialog tag in the stack
This commit is contained in:
parent
eda0ea077c
commit
6f9a385619
@ -104,6 +104,12 @@ export const showDialog = async (
|
||||
addHistory
|
||||
);
|
||||
}
|
||||
const dialogIndex = OPEN_DIALOG_STACK.findIndex(
|
||||
(state) => state.dialogTag === dialogTag
|
||||
);
|
||||
if (dialogIndex !== -1) {
|
||||
OPEN_DIALOG_STACK.splice(dialogIndex, 1);
|
||||
}
|
||||
OPEN_DIALOG_STACK.push({
|
||||
element,
|
||||
root,
|
||||
@ -173,8 +179,10 @@ export const closeLastDialog = async () => {
|
||||
|
||||
export const closeAllDialogs = async () => {
|
||||
for (let i = OPEN_DIALOG_STACK.length - 1; i >= 0; i--) {
|
||||
const closed =
|
||||
!OPEN_DIALOG_STACK[i] ||
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const closed = await closeDialog(OPEN_DIALOG_STACK[i].dialogTag);
|
||||
(await closeDialog(OPEN_DIALOG_STACK[i].dialogTag));
|
||||
if (!closed) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user