fix: clear stale console output during code execution#41
fix: clear stale console output during code execution#41Sarthak-madan334 wants to merge 1 commit into
Conversation
|
@Sarthak-madan334 is attempting to deploy a commit to the rishabhjtripathi2903-3434's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughProblemWorkspace refactors its console to support user-initiated clearing via a new handler and automatically scroll output to the bottom. The run flow now clears prior output state before execution, and console rendering depends on execution status rather than result placeholders. ChangesConsole Clearing and Auto-Scroll
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/sections/ProblemWorkspace.tsx`:
- Around line 96-99: The handleClearConsole currently calls
setIsExecuting(false) which incorrectly clears the active execution flag and can
allow a new run while one is still in flight; update handleClearConsole to only
clear the visible console state by removing the call to setIsExecuting(false)
(leave setExecutionResult(null) intact) so that the running state managed by
isExecuting and the execution logic (the run/execute handler) remains
authoritative and prevents overlapping requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: dbaee72b-76e2-4caa-bb93-94445e615288
📒 Files selected for processing (1)
app/src/sections/ProblemWorkspace.tsx
| const handleClearConsole = () => { | ||
| setExecutionResult(null); | ||
| setIsExecuting(false); | ||
| }; |
There was a problem hiding this comment.
Clearing console should not reset active execution state
Line 98 forces isExecuting to false even if a run is still in flight. That can re-enable “Run Code” early and allow overlapping execute requests with stale/out-of-order output.
Suggested fix
const handleClearConsole = () => {
- setExecutionResult(null);
- setIsExecuting(false);
+ // Clear visible output only; do not mutate in-flight execution state.
+ setExecutionResult(null);
}; <button
onClick={handleClearConsole}
+ disabled={isExecuting}
className="flex items-center gap-1 text-xs text-white/50 hover:text-white transition-colors"
title="Clear console output"
>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src/sections/ProblemWorkspace.tsx` around lines 96 - 99, The
handleClearConsole currently calls setIsExecuting(false) which incorrectly
clears the active execution flag and can allow a new run while one is still in
flight; update handleClearConsole to only clear the visible console state by
removing the call to setIsExecuting(false) (leave setExecutionResult(null)
intact) so that the running state managed by isExecuting and the execution logic
(the run/execute handler) remains authoritative and prevents overlapping
requests.
|
@Sarthak-madan334 include which issues is this pr closing |
|
@Rishabhworkspace I've updated the PR description to include the linked issue ("Closes #17"). |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Closes #17
Changes
Clears previous execution output when Run Code is clicked.
Shows a Running... indicator inside the console panel.
Adds a Clear button to manually clear console output.
Auto-scrolls the console panel when new results arrive.
Testing
Verified old output is cleared immediately on re-run.
Verified Running... indicator appears during execution.
Verified Clear button resets console output.
Verified console scroll behavior on new output.
Summary by CodeRabbit
New Features
Bug Fixes