refactor & perf of file HistoryView.tsx (#2855)

This commit is contained in:
yusheng chen authored and GitHub committed 2025-04-12 23:20:59 -07:00
1 parent 86aadd1bb7
commit dace684afa
2 files changed
+11 -6

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
refactor & perf of file `HistoryView.tsx`
@@ -45,15 +45,15 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
}
}, [searchQuery, sortOption, lastNonRelevantSort])
const handleHistorySelect = (id: string) => {
const handleHistorySelect = useCallback((id: string) => {
vscode.postMessage({ type: "showTaskWithId", text: id })
}
}, [])
const handleDeleteHistoryItem = (id: string) => {
const handleDeleteHistoryItem = useCallback((id: string) => {
vscode.postMessage({ type: "deleteTaskWithId", text: id })
}
}, [])
const formatDate = (timestamp: number) => {
const formatDate = useCallback((timestamp: number) => {
const date = new Date(timestamp)
return date
?.toLocaleString("en-US", {
@@ -66,7 +66,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
.replace(", ", " ")
.replace(" at", ",")
.toUpperCase()
}
}, [])
const presentableTasks = useMemo(() => {
return taskHistory.filter((item) => item.ts && item.task)