Update dialog history state when in invalid state

This commit is contained in:
Bill Thornton 2022-06-09 13:17:56 -04:00
parent c1739c4b7f
commit b30d371e8f

View file

@ -94,7 +94,15 @@ import '../../assets/css/scrollstyles.scss';
if (state.dialogs[state.dialogs.length - 1] === hash) {
history.back();
} 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)
}
);
}
}
}