Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Profile Page #1306

Merged
merged 5 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions src/components/FriendsComponent/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const FriendsComponent = () => {
} else {
const userData = snapshot.docs[0].data();
const fetchedFriends = [];
setName(userData.displayName);
for (const friendUid of userData.Friends) {
setName(userData.name);
for (const friendUid of (userData?.Friends||userData?.friends)) {
const friendData = await getFriendData(friendUid);
if (friendData) {
fetchedFriends.push({
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Profile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ function Profile() {
bio: data.bio ? data.bio : "Hi there! I am using Dummygram.",
country: data.country ? data.country : "Global",
storyTimestamp: data.storyTimestamp,
Friends: data.Friends.length,
Friends: data?.Friends?.length||data?.friends?.length,// same as below
});
setIsFriendAlready(data.Friends.includes(user?.uid));
setIsFriendAlready(data?.Friends?.includes(user?.uid)||data?.friends?.includes(user?.uid)); // old accounts have friends attribute and new accounts have Friends attribute
} else {
setUserExists(false);
}
Expand Down
Loading