Fix vscode returning invalid array object for history state on certain devices

This commit is contained in:
Saoud Rizwan
2024-08-17 11:24:08 -04:00
parent 26fb2780b5
commit 4f00f89bf3
4 changed files with 186 additions and 172 deletions

View File

@@ -2,7 +2,7 @@
"name": "claude-dev",
"displayName": "Claude Dev",
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.",
"version": "1.3.2",
"version": "1.3.3",
"icon": "icon.png",
"engines": {
"vscode": "^1.84.0"

View File

@@ -447,7 +447,7 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
customInstructions,
themeName: vscode.workspace.getConfiguration("workbench").get<string>("colorTheme"),
claudeMessages: this.claudeDev?.claudeMessages || [],
taskHistory: (taskHistory || []).sort((a, b) => b.ts - a.ts),
taskHistory: (taskHistory || []).filter((item) => item.ts && item.task).sort((a, b) => b.ts - a.ts),
shouldShowAnnouncement: lastShownAnnouncementId !== this.latestAnnouncementId,
},
})

View File

@@ -69,8 +69,14 @@ const HistoryPreview = ({ taskHistory, showHistoryView }: HistoryPreviewProps) =
</div>
<div style={{ padding: "0px 20px 0 20px" }}>
{taskHistory.slice(0, 3).map((item) => (
<div key={item.id} className="history-preview-item" onClick={() => handleHistorySelect(item.id)}>
{taskHistory
.filter((item) => item.ts && item.task && item.totalCost)
.slice(0, 3)
.map((item) => (
<div
key={item.id}
className="history-preview-item"
onClick={() => handleHistorySelect(item.id)}>
<div style={{ padding: "12px" }}>
<div style={{ marginBottom: "8px" }}>
<span

View File

@@ -98,14 +98,18 @@ const HistoryView = ({ taskHistory, onDone }: HistoryViewProps) => {
</div>
)}
{taskHistory.map((item, index) => (
{taskHistory
.filter((item) => item.ts && item.task && item.totalCost)
.map((item, index) => (
<div
key={item.id}
className="history-item"
style={{
cursor: "pointer",
borderBottom:
index < taskHistory.length - 1 ? "1px solid var(--vscode-panel-border)" : "none",
index < taskHistory.length - 1
? "1px solid var(--vscode-panel-border)"
: "none",
}}
onClick={() => handleHistorySelect(item.id)}>
<div
@@ -246,7 +250,11 @@ const HistoryView = ({ taskHistory, onDone }: HistoryViewProps) => {
}}>
<i
className="codicon codicon-arrow-right"
style={{ fontSize: "12px", fontWeight: "bold", marginBottom: 0 }}
style={{
fontSize: "12px",
fontWeight: "bold",
marginBottom: 0,
}}
/>
{item.cacheReads?.toLocaleString()}
</span>