Refactor subStatus handling in SidebarProvider for improved clarity

- Updated the logic for determining the `subStatus` in the `SidebarProvider` to streamline the assignment process.
- Enhanced readability by consolidating the conditional checks for `subStatus`, ensuring consistent status updates for tasks and cancellations.
- Maintained existing functionality while improving code maintainability and clarity.
This commit is contained in:
Pawan Osman
2026-07-15 18:17:48 +03:00
parent b63ac10f8f
commit 01a0da3bc9
+5 -3
View File
@@ -247,13 +247,15 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
hit = true;
changed = true;
const timedOut = data.reason === "timeout";
const subStatus =
b.name === "Task" || b.name === "task" || b.subStatus
? (timedOut ? ("error" as const) : ("cancelled" as const))
: b.subStatus;
return {
...b,
status: "error" as const,
result: b.result || (timedOut ? `(timeout after ${Math.round((b.timeoutMs || 0) / 1000)}s)` : "(cancelled)"),
subStatus: (b.name === "Task" || b.name === "task" || b.subStatus)
? (timedOut ? "error" : "cancelled") as const
: b.subStatus,
subStatus,
};
});
return changed ? { ...turn, blocks } : turn;