Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
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 answers
Answer question

0

Are you sure you wrote it in setup()?

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

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!