Skip to content

Potential Race Condition in the mounting of SignedInMenu.jsx and dispatching of loadCurrentUserProfile in authActions.js, at the end of Section 12 #3

@daksh-sagar

Description

@daksh-sagar

Upon logging in, or registering with a user, sometimes I'm getting the error Can't read property photoURL of undefined in the SignedInMenu.jsx component.
I can't reproduce the bug every time though, it happens sometimes and sometimes it doesn't.
It may be due to the fact that SignedInMenu mounts before this

  profileRef.onSnapshot((snapshot) => {
       console.log('Reaching here ?')
       dispatch(listenToCurrentUserProfile(dataFromSnapshot(snapshot)))
       dispatch({ type: APP_LOADED }) 
  })

code in authActions.js gets executed. Also, I don't see the above console.log() statement being executed in the case of the occurrence of bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions