diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index c7cf03cd9..b74626fe5 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -63,11 +63,7 @@ const DevDocTemplate: FC = (props) => { const isHomePage = curPageNode?.pageAttributes?.pageid === HOME_PAGE_ID; - // use window.innerWidth if window is defined else use useResizeDetector width - const { - width = isBrowser() ? window?.innerWidth : 0, - ref, - } = useResizeDetector(); + const { width, ref } = useResizeDetector(); const [params, setParams] = useState({ [TS_HOST_PARAM]: DEFAULT_HOST, [TS_ORIGIN_PARAM]: '', diff --git a/src/components/LeftSidebar/index.tsx b/src/components/LeftSidebar/index.tsx index 531b733d9..8bbcce42c 100644 --- a/src/components/LeftSidebar/index.tsx +++ b/src/components/LeftSidebar/index.tsx @@ -71,9 +71,7 @@ const LeftSideBar = (props: { }, [params[NAV_PREFIX], params[TS_PAGE_ID_PARAM], props.navContent]); useEffect(() => { - if (ref?.current?.offsetWidth) { - props.handleLeftNavChange(ref?.current?.offsetWidth); - } + props.handleLeftNavChange(ref?.current?.offsetWidth); }, [width]); const toggleExpandOnTab = (text: string) => {