ed-roh/mern-social-media

Home Page disappears upon login

stiltz46 opened this issue · 3 comments

Not sure why, but after I login I see the Home Page for about 1/2 a second, then the webpage goes blank.
I've never been able to see the homepage for more than 1/2 a second. Getting a 304 error. I tried clearing my cache, flushing DNS and running security scans. Nothing helps.
image

I had a similar issue.

In index.js in your Navbar folder, replace
const fullName = `${user.firstName} ${user.lastName}`; with

const fullName = user ? `${user.firstName} ${user.lastName}` : "";

It happens because your backend isn't running. So, it doesn't know what user is.

I made the above change and my error changed to this :

Uncaught TypeError: Cannot read properties of undefined (reading '63ed70a168cae755d301f8f0')

If it's the error of find() is not afunction , you just need to destruct the friends from the redux state in Friends.jsx file
const { friends } = useSelector((state) => state.user.friends);