wesbos / advanced-react-rerecord

Trying things out. Feel free to follow along

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to pass resolveFields to lists.Product.findOne to return product.name

Hallvig opened this issue · comments

In https://github.com/wesbos/advanced-react-rerecord/blob/master/finished-files/backend/schemas/CartItem.ts, for lists.Product.findOne() to return not only { id } but { id, name } you need to pass resolveFields: 'id, name', as so:

        let product = await lists.Product.findOne({
          where: { id: String(cartItem.product) },
          resolveFields: 'id, name'
        });
        if (product?.name) {

(I just found out by fooling around with Keystone-next, and the code currently never returns product.name, only product.id).

Really looking forward to the course, you're the best!

thanks! I acutally ran into this in the recording - it was recently added