samuelgozi/firebase-firestore-lite

Promises aren't resolving

Closed this issue · 5 comments

I have a thin middleware I'm writing to manage my app data. I'm trying to use promises with async/await, but when I call ref.set or ref.update the promises never resolve, even though the set or update do actually modify the data properly when I check the database.

  async update(object, value) {
    await Firebase.db.ref(object.$path).update(value)
    console.log('This line never executes')
    return
  }

I traced it back to here:
https://github.com/samuelgozi/firebase-firestore-lite/blob/master/src/Transaction.ts#L125

If I delete the void it all seems to work. I've never seen void used like this before. Is this intentional?

Thanks for opening the issue.
Yes, this is intentional. The void operator should evaluate a given expression, and then return undefined.
I'm not sure the issue is on that line exactly, but I'll take a look right now.

I didn't forget about this issue. I'll take a look at this in the upcoming week.

I'm wondering if maybe there is an issue with my babel config and how promises are polyfilled. If I get a chance, I'll try to setup an example branch with no transpilation to see if I still have the same issue.

I’m pretty sure that’s the issue because I can’t reproduce it, and also almost all tests depend on the promises to work.

I'm closing this issue because I can't reproduce it.
Please let me know if you can reproduce it, and if you can upload a minimum reproducible example.