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

141
Views
Delete document with async/await in Firestore V9

I'm using Firestore v9 within Expo/React Native. I can't properly delete a document using async/await and deleteDoc function. The document removes fine but my app doesn't wait for the completed operation as I expect. It behaves asynchronously.

This is the call code

showDeleteConfirmation(data)
{
    Alert.alert(
        this.title,
        this.message,
        [
          {text: "Yes", onPress: () => this.deleteDococument(data)},
          {text: "No", style: 'cancel'},
        ],
        { cancelable: false }
    )
}

async deleteDococument(data)
{
    const isDataDeleted = await deleteDocFirestore(data)
    console.log(isDataDeleted) // i get undefined
}

deleteDocFirestore function

const deleteDocFirestore = async (user) => {
    try {

    const docUserRef = doc(db, "users", user.UserId);
    
    const userDeleted = await deleteDoc(docUserRef);

    return userDeleted
  } catch (error) {
    console.log(`error`, error.message);
  }
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The deleteDoc() function returns void so you can simply return true from deleteDocFirestore function or false if an error is thrown.

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!