Skip to content

Commit 1999290

Browse files
authored
🐛 When loading the agent list on the /chat page, the drop-down box flashes in the upper right corner.
2 parents 4ebce5c + 79cde76 commit 1999290

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

frontend/app/[locale]/chat/components/chatAgentSelector.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function ChatAgentSelector({
2323
left: 0,
2424
direction: "down",
2525
});
26+
const [isPositionCalculated, setIsPositionCalculated] = useState(false);
2627
const [isAutoSelectInit, setIsAutoSelectInit] = useState(false);
2728
const { t } = useTranslation("common");
2829
const buttonRef = useRef<HTMLDivElement>(null);
@@ -102,6 +103,9 @@ export function ChatAgentSelector({
102103
left: buttonRect.left,
103104
direction,
104105
});
106+
setIsPositionCalculated(true);
107+
} else if (!isOpen) {
108+
setIsPositionCalculated(false);
105109
}
106110
}, [isOpen, isInitialMode]);
107111

@@ -241,6 +245,7 @@ export function ChatAgentSelector({
241245

242246
{/* Portal renders dropdown to body to avoid being blocked by parent container */}
243247
{isOpen &&
248+
isPositionCalculated &&
244249
typeof window !== "undefined" &&
245250
createPortal(
246251
<>

0 commit comments

Comments
 (0)