From 3f6477cd78a2ed96abb66430ef76d0aa6efc59f0 Mon Sep 17 00:00:00 2001 From: sayomaki Date: Wed, 13 Aug 2025 23:55:25 +0800 Subject: [PATCH] Fix assessment code not loading on first load --- src/commons/assessmentWorkspace/AssessmentWorkspace.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index 1348535ddc..b2313bda84 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -239,10 +239,7 @@ const AssessmentWorkspace: React.FC = props => { */ useEffect(() => { checkWorkspaceReset(); - if (assessment != undefined && question.type == 'voting') { - dispatch(LeaderboardActions.setWorkspaceInitialRun(votingId)); - } - }, [dispatch, assessment]); + }); /** * Handles toggling enabling and disabling token counter depending on assessment properties @@ -386,6 +383,8 @@ const AssessmentWorkspace: React.FC = props => { options.programPrependValue = votingQuestionData.prepend; if (props.fromContestLeaderboard) options.editorValue = code; options.programPostpendValue = votingQuestionData.postpend; + // maybe the following dispatch can be placed in a better location + dispatch(LeaderboardActions.setWorkspaceInitialRun(votingId)); break; case QuestionTypes.mcq: // Do nothing