From 0e8113b4afd13a55f051e00a00f29949d92fda72 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Mon, 18 Jul 2022 14:57:53 +0200 Subject: [PATCH] fix: allow users to submit after editing (#46939) If a user runs the tests and they pass, the multifile editor will show a submit button. If the user then edited the page, it would no longer be possible to submit. This ensures the redux store keeps the original, passing, tests and lets the user submit --- client/src/templates/Challenges/classic/editor.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 1d397537af3..560bdf907ff 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -1084,7 +1084,10 @@ const Editor = (props: EditorProps): JSX.Element => { focusIfTargetEditor(); } - if (props.initialTests) initTests(props.initialTests); + // Once a challenge has been completed, we don't want changes to the content + // to reset the tests since the user is already done with the challenge. + if (props.initialTests && !challengeIsComplete()) + initTests(props.initialTests); if (hasEditableRegion() && editor) { if (props.isResetting) {