fix programming evaluation polling #7426
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes continued polling for autograding jobs on the programming submission edit page after the user navigates away (and double polling when they navigate back). Since the autograding job polling would only affect that page's UI, polling should only occur when the user is on that page.
Previous Behavior
Fetching submission details triggered a
setInterval()
timer (viapollJob()
helper function) to poll the backend for ongoing autograding jobs. This timer was not cleared withclearInterval()
when the user navigated away, resulting in the timer being effectively orphaned.Clicking "Run Code" button also calls the
pollJob()
helper function, leading to the same behavior.New Behavior
Fetching submission details no longer triggers polling automatically. Instead, polling is now managed by the
SubmissionEditIndex
React component:Both operations no longer use
pollJob()
helper function. In the future, we might want to revisit whether we want to rewrite other occurrences of the function to avoid the orphan timer issue, or decide if there are some polling calls that should persist between pages.