Closed ryanmio closed 8 months ago
Name | Link |
---|---|
Latest commit | 04907c19f6483c56b7b1772187650e984df3f4df |
Latest deploy log | https://app.netlify.com/sites/decode-me/deploys/65a34ad82ddaa30008dc2119 |
Deploy Preview | https://deploy-preview-59--decode-me.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
This addresses the issue where the leaderboardName was null when a user signed in. The root cause was that the handleUserUpdate function, which fetches the leaderboardName from Firestore, was not being called when the user state updated.
The following changes were made to fix this issue:
Added a useEffect hook in index.js to call handleUserUpdate whenever the user state updates. This ensures that the leaderboardName is fetched from Firestore and set in the state whenever a user signs in.
Added console logs in handleUserUpdate to log the leaderboardName after it's fetched from Firestore and set in the state. This helps with debugging and verifying that the leaderboardName is being correctly fetched and set.
With these changes, the leaderboardName is no longer null when a user signs in, and it is correctly passed as a prop to GameOver.js.