1amageek / pring.ts

Cloud Firestore model framework for TypeScript - Google
https://firebase.google.com/docs/firestore/
MIT License
108 stars 7 forks source link

Count does not update after deleteAll() #12

Closed starhoshi closed 6 years ago

starhoshi commented 6 years ago
  const cart = new Firebase.Cart(FirebaseHelper.idForTest())
    const cartSKU1 = new Firebase.CartSKU(FirebaseHelper.idForTest())
    const cartSKU2 = new Firebase.CartSKU(FirebaseHelper.idForTest())
    const cartSKU3 = new Firebase.CartSKU(FirebaseHelper.idForTest())

    cart.cartSKUs.insert(cartSKU1)
    cart.cartSKUs.insert(cartSKU2)
    cart.cartSKUs.insert(cartSKU3)
    await cart.save()

    const gotCart = await Firebase.Cart.get(cart.id).then(s => s as Firebase.Cart)
    console.log(gotCart.cartSKUs.count())  // 3
    await gotCart.cartSKUs.deleteAll()
    console.log(gotCart.cartSKUs.count())  // 3

cartSKUs は削除されているが、 count が 0 にならない

1amageek commented 6 years ago

fixed

starhoshi commented 6 years ago

I confirmed fixed it. Thanx!