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

109
Vistas
Child Vue component data doesn't load on first page render

In my Vue app I have some child components that previously worked, ie. their respective data loaded fine inside the parent component.

I initially achieved this by adding a key to my child component, a solution that I found online as the recommended way to update data of child components dynamically.The idea is that a component will update automatically any time the key changes.

<upcoming-events :key="rerenderWidgets"/>

I am incrementing the rerenderWidgets value like so. The child data should be ready after the Promises are finished. The following code runs in the method() lifecycle hook after checking if it is the first page load.

const promisesArray = [this.loadPrivate(),this.loadPublic()]
      await Promise.all(promisesArray).then(async() => {
        await this.getCurrentParticipants().then(async(results) => {
         this.currentParticipants = results
         this.rerenderWidgets += 1
    
     })
})

This worked for a while but the child components are no longer loading their data in the Parent until after the second page visit. The renderWidgets gets incremented but somehow the data is now not updated. I don't think I changed anything that could have broken it, but obviously something has.

The child component itself has functions which get data from a module whose data should be ready once the above Promises are done, so I am not sure why it no longer works.

I also tried using the following code in the updated() hook that as it is supposed to run after the page has fully rendered. I figured all of the data should be ready when this function is called. But it doesn't work and seems to invoke a loop that shows the alert repeatedly.

 updated() {
  this.$nextTick(function () {
   alert('rerender....')
   this.rerenderWidgets += 1
  })

If anyone can tell me what might be going wrong and how I might fix it I'd much appreciate the help. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
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