mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +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
|
addHistory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const dialogIndex = OPEN_DIALOG_STACK.findIndex(
|
||||||
|
(state) => state.dialogTag === dialogTag
|
||||||
|
);
|
||||||
|
if (dialogIndex !== -1) {
|
||||||
|
OPEN_DIALOG_STACK.splice(dialogIndex, 1);
|
||||||
|
}
|
||||||
OPEN_DIALOG_STACK.push({
|
OPEN_DIALOG_STACK.push({
|
||||||
element,
|
element,
|
||||||
root,
|
root,
|
||||||
@ -173,8 +179,10 @@ export const closeLastDialog = async () => {
|
|||||||
|
|
||||||
export const closeAllDialogs = async () => {
|
export const closeAllDialogs = async () => {
|
||||||
for (let i = OPEN_DIALOG_STACK.length - 1; i >= 0; i--) {
|
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
|
// 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) {
|
if (!closed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user