Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
Would it be okay to put onSnapshot() inside an onAuthStateChanged()?

I have one collection of users with some data in firestore (with their uid as the key). After login, first thing I want to do is show the user data and the user being able to modify it, but if onSnapshot execute outside onAuthStateChanged before I retrieve the user uid to get the doc ref, it will fail the first time which causes my code to stop executing. For some reason that error is not caught, so is it good practice to put it in onAuthStateChanged to make sure that I get the user uid before the first time onSnapshot is executed?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If your onSnapshot listener depends on the current user, then it's idiomatic to attach that listener on an onAuthStateChanged handler when the user becomes not null, and subsequently detach it there when the user becomes null again.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda