Skip to content

Commit bceb47d

Browse files
committed
fix(deploy): fix deploy Vercel
1 parent 7086b38 commit bceb47d

File tree

1 file changed

+6
-3
lines changed
  • github-automated-repos-page/new/src/app/components/Sidebar

1 file changed

+6
-3
lines changed

github-automated-repos-page/new/src/app/components/Sidebar/Sidebar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { useEffect, useState } from "react";
55
import Link from "next/link";
66
import useCollapse from 'react-collapsed';
77
import { MdOutlineNavigateNext} from 'react-icons/md';
8+
9+
const isBrowser = () => typeof window !== 'undefined';
10+
811
export default function Sidebar() {
912
let url = window.location.pathname;
1013
let parts = url.split('/');
@@ -23,11 +26,11 @@ export default function Sidebar() {
2326
console.log(ScrollPercent)
2427
};
2528

26-
useEffect(() => {
29+
if (isBrowser()) { //Only add the event listener client-side
2730
window.addEventListener("scroll", onScroll)
28-
}, []);
31+
}
32+
2933

30-
3134
return (
3235
<aside className=" fixed min-w-[340px] h-full max-lg:hidden w-0">
3336

0 commit comments

Comments
 (0)