Revert "fix(issues): prevent sticky mini bar oscillation with height placeholder"

This reverts commit 9fb25f4543.
This commit is contained in:
Naiyuan Qing 2026-04-03 18:35:52 +08:00
parent 9fb25f4543
commit 5548d60dbb

View file

@ -112,10 +112,8 @@ export function AgentLiveCard({ issueId, agentName, scrollContainerRef }: AgentL
const [autoScroll, setAutoScroll] = useState(true); const [autoScroll, setAutoScroll] = useState(true);
const [cancelling, setCancelling] = useState(false); const [cancelling, setCancelling] = useState(false);
const [isStuck, setIsStuck] = useState(false); const [isStuck, setIsStuck] = useState(false);
const [cardHeight, setCardHeight] = useState(0);
const scrollRef = useRef<HTMLDivElement>(null); const scrollRef = useRef<HTMLDivElement>(null);
const sentinelRef = useRef<HTMLDivElement>(null); const sentinelRef = useRef<HTMLDivElement>(null);
const cardRef = useRef<HTMLDivElement>(null);
const seenSeqs = useRef(new Set<string>()); const seenSeqs = useRef(new Set<string>());
// Check for active task on mount // Check for active task on mount
@ -239,13 +237,7 @@ export function AgentLiveCard({ issueId, agentName, scrollContainerRef }: AgentL
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
(entries) => { (entries) => {
if (!entries[0]) return; if (entries[0]) setIsStuck(!entries[0].isIntersecting);
const stuck = !entries[0].isIntersecting;
// Capture expanded height before collapsing to use as placeholder
if (stuck && cardRef.current) {
setCardHeight(cardRef.current.offsetHeight);
}
setIsStuck(stuck);
}, },
{ root, threshold: 0, rootMargin: "-40px 0px 0px 0px" }, { root, threshold: 0, rootMargin: "-40px 0px 0px 0px" },
); );
@ -292,10 +284,7 @@ export function AgentLiveCard({ issueId, agentName, scrollContainerRef }: AgentL
{/* Sentinel — zero-height element that IntersectionObserver watches */} {/* Sentinel — zero-height element that IntersectionObserver watches */}
<div ref={sentinelRef} className="mt-4 h-0 pointer-events-none" aria-hidden /> <div ref={sentinelRef} className="mt-4 h-0 pointer-events-none" aria-hidden />
{/* Placeholder preserves card height when stuck, preventing layout shift */}
<div style={{ minHeight: isStuck && cardHeight ? cardHeight : undefined }}>
<div <div
ref={cardRef}
className={cn( className={cn(
"rounded-lg border transition-all duration-200", "rounded-lg border transition-all duration-200",
isStuck isStuck
@ -385,7 +374,6 @@ export function AgentLiveCard({ issueId, agentName, scrollContainerRef }: AgentL
)} )}
</div> </div>
</div> </div>
</div>
</> </>
); );
} }