From a6dc69d5f789fbd4decaeec643e812a7869775b6 Mon Sep 17 00:00:00 2001 From: Mike Wu Date: Sun, 19 Jan 2025 11:32:40 +0900 Subject: [PATCH] clean up interval --- .../contributor/[user_id]/_components/ContributorData.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/(user)/contributor/[user_id]/_components/ContributorData.tsx b/src/app/(user)/contributor/[user_id]/_components/ContributorData.tsx index a821331..e1e865a 100644 --- a/src/app/(user)/contributor/[user_id]/_components/ContributorData.tsx +++ b/src/app/(user)/contributor/[user_id]/_components/ContributorData.tsx @@ -27,10 +27,12 @@ export default function ContributorData(props: ContributorDataProps) { const [time, setTime] = useState(getCurrentTime(tz)) useEffect(() => { - setInterval(() => { + const interval = setInterval(() => { setTime(getCurrentTime(tz)) }, 30000) - }, []) + + return () => clearInterval(interval) + }, [tz]) return (