Skip to content

Commit 0497dab

Browse files
committed
Fix: Profile Posts tab - wait for user data before fetching
1 parent 24a5849 commit 0497dab

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎frontend/src/pages/Profile.jsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ export default function Profile() {
8080
}, [user?._id])
8181

8282
useEffect(() => {
83-
fetchRecentPosts()
84-
}, [fetchRecentPosts])
83+
if (user?._id) {
84+
fetchRecentPosts()
85+
}
86+
}, [user?._id, fetchRecentPosts])
8587

8688
// Load more posts
8789
const loadMorePosts = async () => {

0 commit comments

Comments
 (0)