diff --git a/frontend/src/components/layout/SidebarComponent.tsx b/frontend/src/components/layout/SidebarComponent.tsx index 922b787..2037066 100644 --- a/frontend/src/components/layout/SidebarComponent.tsx +++ b/frontend/src/components/layout/SidebarComponent.tsx @@ -86,11 +86,13 @@ const SidebarComponent: FC = ({ const getClampedWidth = useCallback (( nextWidth: number, containerWidth: number): number => { - const dynamicMaxWidth = getSidebarMaxWidth (containerWidth) + const viewportWidth = + typeof window === 'undefined' ? containerWidth : window.innerWidth + const viewportMaxWidth = Math.floor (viewportWidth * MAX_VIEWPORT_WIDTH_RATIO) const maxAllowedWidth = maxWidth == null - ? dynamicMaxWidth - : Math.max (MIN_SIDEBAR_WIDTH, Math.min (dynamicMaxWidth, maxWidth)) + ? getSidebarMaxWidth (containerWidth) + : Math.max (MIN_SIDEBAR_WIDTH, Math.min (viewportMaxWidth, maxWidth)) return Math.min (maxAllowedWidth, Math.max (MIN_SIDEBAR_WIDTH, nextWidth)) }, [maxWidth])