Conversation
- Add startTime to CommandExecutionStatus schema in types package - Track command start time in executeCommandTool and send to webview - Display "Running Command for Xs" with blinking green dot while executing - Display "Command Ran for Xs" with exit code indicator when completed - Consolidate status display on left side, remove duplicate text
There was a problem hiding this comment.
🧪 PR Review is completed: The PR successfully implements command execution duration tracking and adds the new 'Out of Credits' UI. A few minor improvements can be made to ensure backward compatibility and prevent potential React rendering bugs.
⬇️ Low Priority Suggestions (1)
webview-ui/src/components/chat/CommandExecution.tsx (1 suggestion)
Location:
webview-ui/src/components/chat/CommandExecution.tsx(Lines 198-200)🟡 React Bug
Issue: In React, using
&&with a number can render0in the DOM if the number evaluates to0. While PIDs are typically greater than 0, it's safer to explicitly check forundefinedornullto prevent unintended UI artifacts.Fix: Change the condition to
status.pid !== undefined.Impact: Prevents potential rendering of
0in the UI.- {status.pid && ( - <span className="font-mono text-xs opacity-70">(PID: {status.pid})</span> - )} + {status.pid !== undefined && ( + <span className="font-mono text-xs opacity-70">(PID: {status.pid})</span> + )}
|
|
||
| switch (data.status) { | ||
| case "started": | ||
| startTimeRef.current = data.startTime ?? null |
There was a problem hiding this comment.
🟡 Logic Improvement
Issue: If data.startTime is undefined (e.g., from an older backend version or missing data), startTimeRef.current becomes null. This prevents the timer from starting, causing the UI to display Running Command for 0s indefinitely.
Fix: Fallback to Date.now() if data.startTime is not provided to ensure the timer always functions.
Impact: Improves backward compatibility and ensures the timer UI always works.
| startTimeRef.current = data.startTime ?? null | |
| startTimeRef.current = data.startTime ?? Date.now() |
Uh oh!
There was an error while loading. Please reload this page.