From 577dddd7855572afa71859837a5a09d4d4f9f44d Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Tue, 23 Apr 2024 00:17:37 -0400 Subject: [PATCH] Bug Fix - Readd Updating Friend / Friend Requests --- frontend-next/src/app/app/page.js | 6 +++--- frontend-next/src/components/app/sidebar/home.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend-next/src/app/app/page.js b/frontend-next/src/app/app/page.js index 1ac9d45..b45788a 100644 --- a/frontend-next/src/app/app/page.js +++ b/frontend-next/src/app/app/page.js @@ -7,7 +7,7 @@ import Drawer from '@mui/material/Drawer'; // Firebase Imports import { auth, database } from "../../../firebase-config"; -import { ref, get, set } from "firebase/database"; +import { ref, onValue, set } from "firebase/database"; import { useAuthState } from "react-firebase-hooks/auth" // Component Imports @@ -43,10 +43,10 @@ function Home() { // Authentication Verification / Redirection if Profile Data not Filled out useEffect(() => { if (authUser && authLoading === false) { - get(ref(database, `users/${authUser.uid}`)).then((userData) => { + onValue(ref(database, `users/${authUser.uid}`), (userData) => { userData = userData.val(); if (userData) { - setUser({...userData}); + setUser(userData); } else { window.location.href = "/onboarding"; } diff --git a/frontend-next/src/components/app/sidebar/home.js b/frontend-next/src/components/app/sidebar/home.js index 5638e46..b027b25 100644 --- a/frontend-next/src/components/app/sidebar/home.js +++ b/frontend-next/src/components/app/sidebar/home.js @@ -156,7 +156,7 @@ export function Sidebar({user,location,loadingLoc}) { } }) - }, []) + }, [user.friends]) return (