Update dialog history state when in invalid state
This commit is contained in:
parent
c1739c4b7f
commit
b30d371e8f
1 changed files with 9 additions and 1 deletions
|
@ -94,7 +94,15 @@ import '../../assets/css/scrollstyles.scss';
|
||||||
if (state.dialogs[state.dialogs.length - 1] === hash) {
|
if (state.dialogs[state.dialogs.length - 1] === hash) {
|
||||||
history.back();
|
history.back();
|
||||||
} else if (state.dialogs.includes(hash)) {
|
} else if (state.dialogs.includes(hash)) {
|
||||||
console.info('[dialogHelper] dialog "%s" was closed, but is not the last dialog opened', hash);
|
console.warn('[dialogHelper] dialog "%s" was closed, but is not the last dialog opened', hash);
|
||||||
|
// Remove the closed dialog hash from the history state
|
||||||
|
history.replace(
|
||||||
|
`${history.location.pathname}${history.location.search}`,
|
||||||
|
{
|
||||||
|
...state,
|
||||||
|
dialogs: state.dialogs.filter(dialog => dialog !== hash)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue