From b30d371e8f6e2d0bdbb7b3e032e72d8113712d1a Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 9 Jun 2022 13:17:56 -0400 Subject: [PATCH] Update dialog history state when in invalid state --- src/components/dialogHelper/dialogHelper.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/dialogHelper/dialogHelper.js b/src/components/dialogHelper/dialogHelper.js index beccf23dc4..80b269fed5 100644 --- a/src/components/dialogHelper/dialogHelper.js +++ b/src/components/dialogHelper/dialogHelper.js @@ -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) + } + ); } } }