Skip to content

Commit

Permalink
VKT(Frontend): Ensure correct exam event details are when entering th…
Browse files Browse the repository at this point in the history
…e ExaminerExamEventOverviewPage [deploy]
  • Loading branch information
pkoivisto committed Nov 15, 2024
1 parent 6ed4b8b commit cb8c489
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { ClerkExamEventOverviewPageSkeleton } from 'components/skeletons/ClerkEx
import { useClerkTranslation, useCommonTranslation } from 'configs/i18n';
import { useAppDispatch, useAppSelector } from 'configs/redux';
import { AppRoutes, ExamLevel } from 'enums/app';
import { loadExaminerExamEventOverview } from 'redux/reducers/examinerExamEventOverview';
import {
loadExaminerExamEventOverview,
resetExaminerExamEventOverview,
} from 'redux/reducers/examinerExamEventOverview';
import { examinerExamEventOverviewSelector } from 'redux/selectors/examinerExamEventOverview';
import { ExamEventUtils } from 'utils/examEvent';

Expand Down Expand Up @@ -41,9 +44,9 @@ export const ExaminerExamEventOverviewPage: FC = () => {
useEffect(() => {
if (
overviewStatus === APIResponseStatus.NotStarted &&
!examEventId &&
params.examEventId &&
params.oid
params.oid &&
examEventId !== parseInt(params.examEventId)
) {
// Fetch exam event overview
dispatch(
Expand Down Expand Up @@ -74,6 +77,13 @@ export const ExaminerExamEventOverviewPage: FC = () => {
t,
]);

// Reset state on unmount
useEffect(() => {
return () => {
dispatch(resetExaminerExamEventOverview());
};
}, [dispatch]);

const pageHeader = examEvent
? `${ExamEventUtils.languageAndLevelText(
examEvent.language,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const examinerExamEventOverviewSlice = createSlice({
) {
state.overviewStatus = APIResponseStatus.InProgress;
},
resetExaminerExamEventOverview(_) {
return initialState;
},
storeExaminerExamEventOverview(
state,
action: PayloadAction<ExaminerExamEvent>,
Expand All @@ -45,4 +48,5 @@ export const {
loadExaminerExamEventOverview,
storeExaminerExamEventOverview,
rejectExaminerExamEventOverview,
resetExaminerExamEventOverview,
} = examinerExamEventOverviewSlice.actions;

0 comments on commit cb8c489

Please sign in to comment.