Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/pages/Friends.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
return Array.from(networkMap.values()).sort((a, b) => (b.totalPoints || 0) - (a.totalPoints || 0));
}, [connections.followers, connections.following, currentUser, userData]);

const activeDevelopers = activeTab === "leaderboard" ? leaderboardStandings : connections[activeTab] || [];

Check warning on line 138 in src/pages/Friends.jsx

View workflow job for this annotation

GitHub Actions / Lint Check

The 'activeDevelopers' conditional could make the dependencies of useMemo Hook (at line 144) change on every render. Move it inside the useMemo callback. Alternatively, wrap the initialization of 'activeDevelopers' in its own useMemo() Hook
const filteredDevelopers = React.useMemo(() => {
return activeDevelopers.filter(dev => {
if (selectedCollege === "All") return true;
Expand All @@ -152,7 +152,11 @@

const handleToggleFollow = async (developerId) => {
const isFollowing = followingIds.includes(developerId);
// Directly mutate Firebase. The onSnapshot listener will automatically update the UI!
if (isFollowing) {
const dev = developers.find(d => d.id === developerId);
const username = dev?.username || dev?.displayName || "this user";
if (!window.confirm(`Are you sure you want to unfollow @${username}?`)) return;
}
await toggleFollowStatus(currentUser.uid, developerId, isFollowing);
};

Expand Down
Loading