Skip to content
Prev Previous commit
Next Next commit
remove useEffect per feedback
  • Loading branch information
mafredri committed Nov 27, 2025
commit c4827db3cc755a8aa38f4dcba254b63cc114cdbc
20 changes: 10 additions & 10 deletions site/src/pages/TasksPage/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useSearchParamsKey } from "hooks/useSearchParamsKey";
import { ChevronDownIcon, TrashIcon } from "lucide-react";
import { useDashboard } from "modules/dashboard/useDashboard";
import { TaskPrompt } from "modules/tasks/TaskPrompt/TaskPrompt";
import { type FC, useEffect, useState } from "react";
import { type FC, useState } from "react";
import { useQuery } from "react-query";
import { cn } from "utils/cn";
import { pageTitle } from "utils/page";
Expand Down Expand Up @@ -96,13 +96,6 @@ const TasksPage: FC = () => {
(t) => t.workspace_id !== null,
).length;

// Clear selections when switching tabs/filters to avoid confusing UX
// where selected tasks might no longer be visible.
// biome-ignore lint/correctness/useExhaustiveDependencies: Reset on tab/filter changes.
useEffect(() => {
setCheckedTaskIds(new Set());
}, [tab.value, ownerFilter.value]);

return (
<>
<title>{pageTitle("AI Tasks")}</title>
Expand Down Expand Up @@ -130,14 +123,20 @@ const TasksPage: FC = () => {
<div className="flex items-center bg-surface-secondary rounded p-1">
<PillButton
active={tab.value === "all"}
onClick={() => tab.setValue("all")}
onClick={() => {
tab.setValue("all");
setCheckedTaskIds(new Set());
}}
>
All tasks
</PillButton>
<PillButton
disabled={!idleTasks || idleTasks.length === 0}
active={tab.value === "waiting-for-input"}
onClick={() => tab.setValue("waiting-for-input")}
onClick={() => {
tab.setValue("waiting-for-input");
setCheckedTaskIds(new Set());
}}
>
Waiting for input
{idleTasks && idleTasks.length > 0 && (
Expand All @@ -154,6 +153,7 @@ const TasksPage: FC = () => {
ownerFilter.setValue(
username === ownerFilter.value ? "" : username,
);
setCheckedTaskIds(new Set());
}}
/>
</section>
Expand Down
Loading