Skip to content

Problem Workspace Console Shows Stale Output During New Execution #17

Description

@Rishabhworkspace

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

  • At the start of handleRunCode, set executionResult to null before the async Piston API call.
  • Add a "Running..." text/indicator in the console panel when isExecuting is true.
  • Add a "Clear" button (trash icon from lucide-react) in the console panel header.
  • Use a useRef on the console scroll container and call scrollToBottom() whenever executionResult changes.

Acceptance Criteria

  • Old results are cleared immediately when "Run Code" is pressed.
  • A "Running..." indicator appears in the console panel body.
  • A "Clear" button is present in the console header.
  • Console auto-scrolls to show new results.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions