From 206efc490037fa6bb37e961fe8fd01415718d532 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:42:58 -0400 Subject: [PATCH] fix: resolve issues page flickering and tile memory exhaustion (#968) --- src/renderer/src/components/TaskPage.tsx | 4 ++-- .../components/tab-group/useTabDragSplit.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/renderer/src/components/TaskPage.tsx b/src/renderer/src/components/TaskPage.tsx index 884235cc2..47b727951 100644 --- a/src/renderer/src/components/TaskPage.tsx +++ b/src/renderer/src/components/TaskPage.tsx @@ -972,7 +972,7 @@ export default function TaskPage(): React.JSX.Element { {item.labels.slice(0, 3).map((label) => ( {label} @@ -1020,7 +1020,7 @@ export default function TaskPage(): React.JSX.Element { e.stopPropagation() handleUseWorkItem(item) }} - className="inline-flex items-center gap-1 rounded-md border border-border/50 bg-background/50 backdrop-blur-md px-2 py-1 text-[11px] text-foreground transition hover:bg-muted/60 supports-[backdrop-filter]:bg-background/50" + className="inline-flex items-center gap-1 rounded-md border border-border/50 bg-background/80 px-2 py-1 text-[11px] text-foreground transition hover:bg-muted/60" > Use diff --git a/src/renderer/src/components/tab-group/useTabDragSplit.ts b/src/renderer/src/components/tab-group/useTabDragSplit.ts index bcd7c5551..34d5f3497 100644 --- a/src/renderer/src/components/tab-group/useTabDragSplit.ts +++ b/src/renderer/src/components/tab-group/useTabDragSplit.ts @@ -167,16 +167,16 @@ export function useTabDragSplit({ const [activeDrag, setActiveDrag] = useState(null) const [hoveredDropTarget, setHoveredDropTarget] = useState(null) - const pointerSensor = useSensor(PointerSensor, { - activationConstraint: { distance: 5 } - }) - const activeSensors = useSensors(pointerSensor) - const emptySensors = useSensors() // Why: hidden worktrees stay mounted so their PTYs survive worktree - // switches, but their DndContext should not register pointer listeners - // on the document. Multiple active DndContext instances can interfere - // with each other. - const sensors = enabled ? activeSensors : emptySensors + // switches, but their DndContext should not activate drags. We use an + // impossible activation distance rather than switching between + // useSensors(ptr) / useSensors(), because dnd-kit internally spreads + // the sensors array into a useEffect dependency list — changing its + // length between renders violates React's rules of hooks. + const pointerSensor = useSensor(PointerSensor, { + activationConstraint: { distance: enabled ? 5 : Number.MAX_SAFE_INTEGER } + }) + const sensors = useSensors(pointerSensor) const clearDragState = useCallback(() => { setActiveDrag(null)