Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
Get documents from Firebase but if they are already showing - dont show again

I have the following code:

const getFromFirebase = () => {
    //1.
    let storageRef = storage.ref(`${user1}/${currentItem.id}`);
    //2.
    storageRef.listAll().then(function (res) {
        //3.
        res.items.forEach((imageRef) => {
          imageRef.getDownloadURL().then((url) => {
              //4.
              if (allImages.indexOf(url) === -1) {
              setImages((allImages) => [...allImages, ({Test : url, Test2 : imageRef.name})]);
              }
          });
        });
        
      })
      .catch(function (error) {
        console.log(error);
      });
  };

I am calling this function on a tab onclick - it works in that it shows the documents but if I click the tab again it simply repeats itself - how do I run a check that if all documents are showing already to not double up?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

work with callback function, you did not enter an empty array.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda