Closed Hallvig closed 3 years ago
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:
lists.Product.findOne()
{ id }
{ id, name }
resolveFields: 'id, name'
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).
product.name
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
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 passresolveFields: 'id, name'
, as so:(I just found out by fooling around with Keystone-next, and the code currently never returns
product.name
, onlyproduct.id
).Really looking forward to the course, you're the best!