fix: resolve issues page flickering and tile memory exhaustion (#968)
This commit is contained in:
@@ -972,7 +972,7 @@ export default function TaskPage(): React.JSX.Element {
|
||||
{item.labels.slice(0, 3).map((label) => (
|
||||
<span
|
||||
key={label}
|
||||
className="rounded-full border border-border/50 bg-background/50 backdrop-blur-md px-1.5 py-0 text-[10px] text-muted-foreground supports-[backdrop-filter]:bg-background/50"
|
||||
className="rounded-full border border-border/50 bg-background/80 px-1.5 py-0 text-[10px] text-muted-foreground"
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
@@ -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
|
||||
<ArrowRight className="size-3" />
|
||||
|
||||
@@ -167,16 +167,16 @@ export function useTabDragSplit({
|
||||
const [activeDrag, setActiveDrag] = useState<TabDragItemData | null>(null)
|
||||
const [hoveredDropTarget, setHoveredDropTarget] = useState<HoveredTabDropTarget | null>(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)
|
||||
|
||||
Reference in New Issue
Block a user