This page is not created by, affiliated with, or supported by Slack Technologies, Inc.


anyone using with datascript? aside obvious benefits, what pitfalls should be avoided?


Having a simple problem I can’t seem to solve. Building a demo app of a shopping carts. Products and a cart. When you click “add to cart” from a product in the listing the item appears in a cart. I have all this working except when I push an item into cart_items I’m not sure how I’m suppose to do this — I need to keep track of count since you can say purchase more than one of same product. So my initial idea was: {:products [{id: 1 name: “Foo”}] :cart {1: {count: 3 product: [:product/by-id 1]}}}


so I’ve made my :cart db-style (a map whose keys are the product ids) so I can easily update the count. Is this bad? Should I consider a different way, most importantly, I need to get that product info when I’m rendering a CartItem and I don’t know how to do it


it seems easier to make cart just be a vector


updating the count may look weird, but probably will be fast enough anyway?


@tomjack: yeah, I can’t seem to figure out how to get the data for the product into the cart item doing it the way I am right now


so I might as well try that


it seems maybe doable with the map if you write some custom read logic, but I'm not sure what to do about ui->props


I'm thinking default-ui->props with path-meta might be confused


@tomjack so, I’m trying the other route. you’ll see in my init data I’ve primed the cart, but I still can’t get that product ref to work, I’m assuming the issue is in my defui for CartItem


It seems to me that your CartItem query should be something like [:id :count {:product (om/get-query ...)}]


Have you deref'd the reconciler to see what your normalized data looks like?