From 8972892fdd76ec4abc1849e1793c63f568624a58 Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Wed, 13 Nov 2024 12:52:00 -0800 Subject: [PATCH] delete modal from search when trying to close the practice questions --- .../components/PracticeQuestionsPopup.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/content/practiceQuestions/components/PracticeQuestionsPopup.tsx b/src/app/content/practiceQuestions/components/PracticeQuestionsPopup.tsx index aee88a234d..49c3b1a2d1 100644 --- a/src/app/content/practiceQuestions/components/PracticeQuestionsPopup.tsx +++ b/src/app/content/practiceQuestions/components/PracticeQuestionsPopup.tsx @@ -31,7 +31,15 @@ const PracticeQuestionsPopup = () => { if (!assertWindow().confirm(message)) { return; } } - dispatch(push(assertDefined(match, 'match should be always defined at this step'))); + const definedMatch = assertDefined(match, 'match should be always defined at this step'); + + if ('search' in definedMatch && typeof definedMatch.search === 'string') { + const params = new URLSearchParams(definedMatch.search); + params.delete('modal'); + definedMatch.search = params.toString(); + } + + dispatch(push(definedMatch)); trackOpenClosePQ(method); }, [currentQuestionIndex, trackOpenClosePQ, intl, dispatch, match]);