diff --git a/src/renderer/src/pages/game-details/sidebar-section/sidebar-section.tsx b/src/renderer/src/pages/game-details/sidebar-section/sidebar-section.tsx index 4b01adeb..e24f677b 100644 --- a/src/renderer/src/pages/game-details/sidebar-section/sidebar-section.tsx +++ b/src/renderer/src/pages/game-details/sidebar-section/sidebar-section.tsx @@ -14,10 +14,12 @@ export function SidebarSection({ title, children }: SidebarSectionProps) { const [height, setHeight] = useState(0); useEffect(() => { - if (content.current) { + if (content.current && content.current.scrollHeight !== height) { setHeight(isOpen ? content.current.scrollHeight : 0); + } else if (!isOpen) { + setHeight(0); } - }, [isOpen, children]); + }, [isOpen, children, height]); return (