diff --git a/webview-ui/src/components/history/HistoryPreview.tsx b/webview-ui/src/components/history/HistoryPreview.tsx index d9b2713a36..e0ba82f631 100644 --- a/webview-ui/src/components/history/HistoryPreview.tsx +++ b/webview-ui/src/components/history/HistoryPreview.tsx @@ -36,7 +36,7 @@ const HistoryPreview = () => {
- {tasks.slice(0, maxTasksHomeScreen).map((item) => ( + {tasks.slice(0, Math.max(0, Math.min(20, maxTasksHomeScreen ?? 4))).map((item) => ( ))}
diff --git a/webview-ui/src/components/history/__tests__/HistoryPreview.spec.tsx b/webview-ui/src/components/history/__tests__/HistoryPreview.spec.tsx index 427f73de6a..4eb753e31d 100644 --- a/webview-ui/src/components/history/__tests__/HistoryPreview.spec.tsx +++ b/webview-ui/src/components/history/__tests__/HistoryPreview.spec.tsx @@ -148,7 +148,7 @@ describe("HistoryPreview", () => { render() - // Should render only the first 3 tasks + // Should render only the first 4 tasks expect(screen.getByTestId("task-item-task-1")).toBeInTheDocument() expect(screen.getByTestId("task-item-task-2")).toBeInTheDocument() expect(screen.getByTestId("task-item-task-3")).toBeInTheDocument()