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

116
Vistas
I can't fetch data from Firebase to Vue

I'm following a Youtube tutorial to learn more about storing data in Firebase and then interacting with it in Vue. https://www.youtube.com/watch?v=Htt8AKeF1Kw (at 5:00 is the problem I'm facing)

Basically I follow everything there but the data doesn't show on my vue project and when I open console I see: onUnmounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.

I'm loading 'animes' from Firebase with the following code on firebase.js

export const loadAnimes = () => {
const animes = ref([])
const close = animeCollection.onSnapshot(snapshot => {
    animes.value = snapshot.docs.map(doc => ({
        id: doc.id, ...doc.data()
    }))
    onUnmounted(close)  
    return animes
})

From this then I pass it to a component

EDIT: Fixed the issue, it was a mistake on my end, onMounted(close) and return animes should be 2 lines below

export const loadAnimes = () => {
const animes = ref([]) 
const close = animeCollection.onSnapshot(snapshot => {
    animes.value = snapshot.docs.map(doc => ({
        id: doc.id, ...doc.data()
    })) 
})
onUnmounted(close)
return animes
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Are you sure you wrote it in setup()?

setup() {
    onUnmounted(() => {
      ...
    })
}```
about 4 years ago · Juan Pablo Isaza Denunciar

0

The issue was on my end, basically unMounted(close) and return anime should be two lines below

export const loadAnimes = () => {
const animes = ref([]) 
const close = animeCollection.onSnapshot(snapshot => {
    animes.value = snapshot.docs.map(doc => ({
        id: doc.id, ...doc.data()
    }))         
})
onUnmounted(close)  
return animes
}
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