Skip to content

Commit 9101d2e

Browse files
authored
Fix assessment code not loading on first load (#3303)
1 parent 8e1ec1f commit 9101d2e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/commons/assessmentWorkspace/AssessmentWorkspace.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
239239
*/
240240
useEffect(() => {
241241
checkWorkspaceReset();
242-
if (assessment != undefined && question.type == 'voting') {
243-
dispatch(LeaderboardActions.setWorkspaceInitialRun(votingId));
244-
}
245-
}, [dispatch, assessment]);
242+
});
246243

247244
/**
248245
* Handles toggling enabling and disabling token counter depending on assessment properties
@@ -386,6 +383,8 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
386383
options.programPrependValue = votingQuestionData.prepend;
387384
if (props.fromContestLeaderboard) options.editorValue = code;
388385
options.programPostpendValue = votingQuestionData.postpend;
386+
// maybe the following dispatch can be placed in a better location
387+
dispatch(LeaderboardActions.setWorkspaceInitialRun(votingId));
389388
break;
390389
case QuestionTypes.mcq:
391390
// Do nothing

0 commit comments

Comments
 (0)