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

155
Visualizações
Firebase Realtime Database Property Listener

I have some data like so: leaderboards/board/{board id}/{child properties}

Screen capture of example data in Realtime Database

I have an added listener for boards, like so:

const boardRef = firebase.database().ref('leaderboards/board');
boardRef.on('child_added', (snapshot) => {
    // handle data
});

That part works fine. I then later want to listen to just a specific property on a board, to see if it changes. I do not want to listen to all child changes on the board, as a couple of the children can change really frequently and we don't want to be handling that much data except when needed (a certain app state). So, I tried this:

const endedRef = firebase.database().ref('leaderboards/board/123/ended');
endedRef.on('value', (snapshot) => {
    // handle data
});

However, when I update the 'ended' property in Firebase, the listener isn't called. It's only called when I first add the listener (so it appears to be hooked up properly) but then not when the property is changed. What's the proper way to solve this?

This post is similar, but as I'm already trying a 'value' listener on the property, seems to either not be a fix or not work for my data: How to listen to a specific value change in Firebase?

Thanks for any and all help!

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

0

This was related to something specific in my codebase, causing my listener removal to get triggered just after getting added. So if you're having a similar issue, check where you remove the listener!

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