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

226: Fixed infinite fetching and uncommented roster #247

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

maxfukuh4ra
Copy link
Collaborator

@maxfukuh4ra maxfukuh4ra commented Nov 22, 2024

#226

I modified the following code by removing the dependency array to avoid infinite fetching. Also uncommented our roster on dashboard so I can inspect network and check. Pretty straight forward nothing crazy, sorry burned some reads while I was checking it to make sure that was what was causing it lol.

  useEffect(() => {
    const fetchTeams = async () => {
      try {
        const querySnapshot = await getDocs(collection(db, 'teams'))
        const teamsData = querySnapshot.docs.map((doc) => doc.data())
        const mensTeam = teamsData.find((team) => team.name === 'UCLA (M)')
        const playersArray = mensTeam.players.map((player) => ({
          firstName: player.firstName,
          lastName: player.lastName,
          photoUrl: player.photo
        }))
        setMensRoster(playersArray)
      } catch (error) {
        console.error('Error retrieving teams:', error)
      }
    }

    fetchTeams()
  }, []) // removed mensroster from here

@maxfukuh4ra maxfukuh4ra changed the title #226: Fixed infinite fetching and uncommented roster 226: Fixed infinite fetching and uncommented roster Nov 22, 2024
Copy link
Collaborator

@Fredenck Fredenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, thanks

@Fredenck Fredenck merged commit 4ccf7f2 into development Nov 23, 2024
@Fredenck Fredenck deleted the 226-rosterlist-infinite-fetching branch November 23, 2024 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants