Skip to content

Commit e221174

Browse files
author
Eric Wheeler
committed
perf: remove duplicate tasks query
Removed redundant useTaskSearch call from ChatView since HistoryPreview already makes its own call to fetch the tasks it needs to display. This eliminates an unnecessary API call on application startup and simplifies the component by removing conditional rendering based on task count. Signed-off-by: Eric Wheeler <[email protected]>
1 parent 693c34f commit e221174

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import { useAutoApprovalToggles } from "@src/hooks/useAutoApprovalToggles"
4444

4545
import TelemetryBanner from "../common/TelemetryBanner"
4646
import VersionIndicator from "../common/VersionIndicator"
47-
import { useTaskSearch } from "../history/useTaskSearch"
4847
import HistoryPreview from "../history/HistoryPreview"
4948
import Announcement from "./Announcement"
5049
import BrowserSessionRow from "./BrowserSessionRow"
@@ -121,8 +120,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
121120
messagesRef.current = messages
122121
}, [messages])
123122

124-
const { tasks } = useTaskSearch({ limit: 10 })
125-
126123
// Initialize expanded state based on the persisted setting (default to expanded if undefined)
127124
const [isExpanded, setIsExpanded] = useState(
128125
historyPreviewCollapsed === undefined ? true : !historyPreviewCollapsed,
@@ -1673,20 +1670,15 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
16731670
) : (
16741671
<div className="flex-1 min-h-0 overflow-y-auto flex flex-col gap-4 relative">
16751672
{/* Moved Task Bar Header Here */}
1676-
{tasks.length !== 0 && (
1677-
<div className="flex text-vscode-descriptionForeground w-full mx-auto px-5 pt-3">
1678-
<div className="flex items-center gap-1 cursor-pointer" onClick={toggleExpanded}>
1679-
{tasks.length < 10 && (
1680-
<span className={`font-medium text-xs `}>{t("history:recentTasks")}</span>
1681-
)}
1682-
<span
1683-
className={`codicon ${isExpanded ? "codicon-eye" : "codicon-eye-closed"} scale-90`}
1684-
/>
1685-
</div>
1673+
<div className="flex text-vscode-descriptionForeground w-full mx-auto px-5 pt-3">
1674+
<div className="flex items-center gap-1 cursor-pointer" onClick={toggleExpanded}>
1675+
<span
1676+
className={`codicon ${isExpanded ? "codicon-eye" : "codicon-eye-closed"} scale-90`}
1677+
/>
16861678
</div>
1687-
)}
1679+
</div>
16881680
<div
1689-
className={` w-full flex flex-col gap-4 m-auto ${isExpanded && tasks.length > 0 ? "mt-0" : ""} px-3.5 min-[370px]:px-10 pt-5 transition-all duration-300`}>
1681+
className={` w-full flex flex-col gap-4 m-auto px-3.5 min-[370px]:px-10 pt-5 transition-all duration-300`}>
16901682
{/* Version indicator in top-right corner - only on welcome screen */}
16911683
<VersionIndicator
16921684
onClick={() => setShowAnnouncementModal(true)}

0 commit comments

Comments
 (0)