From 0010212d35ea50e04d47dd97733070502f886739 Mon Sep 17 00:00:00 2001 From: Sterling Archer Date: Thu, 18 Jun 2026 23:40:48 -0700 Subject: [PATCH] Add debug logging to loadFriendProfilesAndSteps --- index.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 23fab65..a94a3f7 100644 --- a/index.html +++ b/index.html @@ -974,6 +974,7 @@ function getPendingFriendUids() { } async function loadFriendProfilesAndSteps(uids) { + console.log('loadFriendProfilesAndSteps uids:', uids); for (const uid of uids) { if (!friendProfiles[uid]) { const pSnap = await getDoc(doc(db, 'profiles', uid)); @@ -983,10 +984,18 @@ async function loadFriendProfilesAndSteps(uids) { const sSnap = await getDoc(doc(db, 'steps', uid)); friendSteps[uid] = sSnap.exists() ? sSnap.data().stepsByDate || {} : {}; } - const theirRef = doc(db, 'friends', uid, 'list', currentUser.uid); - const theirSnap = await getDoc(theirRef); - mutualApproved[uid] = theirSnap.exists() && theirSnap.data().approved === true && theirSnap.data().enabled !== false; + try { + const theirRef = doc(db, 'friends', uid, 'list', currentUser.uid); + const theirSnap = await getDoc(theirRef); + console.log('their entry exists:', theirSnap.exists(), 'data:', JSON.stringify(theirSnap.data())); + mutualApproved[uid] = theirSnap.exists() && theirSnap.data().approved === true && theirSnap.data().enabled !== false; + } catch(e) { + console.error('mutualApproved check failed for', uid, e); + mutualApproved[uid] = false; + } + console.log('mutualApproved[uid]:', uid, mutualApproved[uid]); } + console.log('final mutualApproved:', JSON.stringify(mutualApproved)); } // LEADERBOARD