Fix React useEffect missing dependency causing infinite loader on Dashboard

This commit is contained in:
2026-09-22 19:05:52 +05:30
parent 2326b3baa7
commit 8061ca2608

View File

@@ -25,7 +25,7 @@ export default function DashboardPage() {
} }
async function fetchStats() { async function fetchStats() {
try { try {
const res = await fetch(`/api/users/${userId}/stats`) const res = await fetch(`/api/users/${currentUserId}/stats`)
if (res.ok) { if (res.ok) {
const data = await res.json() const data = await res.json()
setUserStats(data) setUserStats(data)
@@ -37,7 +37,7 @@ export default function DashboardPage() {
} }
} }
fetchStats() fetchStats()
}, [user?.id]) }, [userLoading, user?.id, userId])
const handleExport = async () => { const handleExport = async () => {
try { try {