Description
In ProblemWorkspace.tsx, when the user clicks "Run Code" a second time, the previous execution output remains visible in the console panel until the new results arrive. The only indicator that a new run is in progress is the loading spinner on the Run button itself. If execution takes several seconds, the user cannot tell whether they are looking at old or new results. Additionally, there is no way to manually clear the console output.
Requirements
- When "Run Code" is clicked, immediately clear the previous
executionResult state before the async call begins.
- Display a "Running..." indicator inside the console panel (not just on the button).
- Add a "Clear" button in the console panel header to manually clear output.
- Auto-scroll the console panel to the bottom when new results arrive.
Expected Behavior
"Run Code" Clicked — Console panel immediately clears and shows "Running..." text. Run button shows its loading spinner. Results replace the "Running..." text when execution completes.
"Clear" Button Clicked — Console output is cleared. Default message "Execute code to see output here." is shown.
Tasks
Acceptance Criteria
Description
In
ProblemWorkspace.tsx, when the user clicks "Run Code" a second time, the previous execution output remains visible in the console panel until the new results arrive. The only indicator that a new run is in progress is the loading spinner on the Run button itself. If execution takes several seconds, the user cannot tell whether they are looking at old or new results. Additionally, there is no way to manually clear the console output.Requirements
executionResultstate before the async call begins.Expected Behavior
"Run Code" Clicked — Console panel immediately clears and shows "Running..." text. Run button shows its loading spinner. Results replace the "Running..." text when execution completes.
"Clear" Button Clicked — Console output is cleared. Default message "Execute code to see output here." is shown.
Tasks
handleRunCode, setexecutionResulttonullbefore the async Piston API call.isExecutingistrue.useRefon the console scroll container and callscrollToBottom()wheneverexecutionResultchanges.Acceptance Criteria