diff --git a/.changeset/dull-pianos-confess.md b/.changeset/dull-pianos-confess.md new file mode 100644 index 00000000..af6985f9 --- /dev/null +++ b/.changeset/dull-pianos-confess.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +refactor & perf of file `HistoryView.tsx` diff --git a/webview-ui/src/components/history/HistoryView.tsx b/webview-ui/src/components/history/HistoryView.tsx index 7bd18843..30de7c94 100644 --- a/webview-ui/src/components/history/HistoryView.tsx +++ b/webview-ui/src/components/history/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)