Skip to content

NestedCollection's forEach is not working #10

@starhoshi

Description

@starhoshi
export class Cart extends Pring.Base {
  @property cartSKUs: Pring.NestedCollection<CartSKU> = new Pring.NestedCollection(this)
}

export class CartSKU extends Pring.Base {
  @property quantity: number
}
      const cart = new Firebase.Cart()
      cart.init(cartSnapshot)

      console.log(cart.cartSKUs.objects) // => []
      cart.cartSKUs.forEach(c => {
        console.log('c.id', c.id)
      })

      const cartSKUs = await cart.cartSKUs.getReference().get().then(s => s.docs)
      cartSKUs.forEach(c => {
        console.log(c.id) // => logged cartSKU id
      })

Collection の forEach を実行しても、 objects が [] なので for が周りません。
firestore を直で叩くと cartSKU 情報は取得できているので、情報は存在します。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions