From 7e0b6910f6c22c75e17e3824fa0d852f9c856177 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 4 Jul 2026 14:34:16 +0900 Subject: [PATCH] #385 --- frontend/src/components/layout/SidebarComponent.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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])