reactioncommerce / api-plugin-carts

Carts plugin for the Reaction API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

imageURLs missing in CartItem

tedraykov opened this issue ยท comments

Issue Description

When querying for the images of a cart item, a null value is returned even for items that have images defined.

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue?

Steps to Reproduce

Running the following query for a cart that has an item with images:

query anonymousCartByCartIdQuery(
  $cartId: ID!
  $cartToken: String!
  $itemsAfterCursor: ConnectionCursor
) {
  cart: anonymousCartByCartId(cartId: $cartId, cartToken: $cartToken) {
    items(first: 20, after: $itemsAfterCursor) {
      nodes {
        imageURLs {
          large
          small
          original
          medium
          thumbnail
        }
      }
    }
  }
}

Returns:

{
  "data": {
    "cart": {
      "items": {
        "nodes": [
          {
            "imageURLs": null
          }
        ]
      }
    }
  }
}

Possible Solution

Looking into the code looks like nowhere in the resolvers the imageURLs property is set.
A possible solution is to query the needed media in the CartItem resolver, similar to how it's done in the products plugin.

Versions

4.0.0

๐ŸŽ‰ This issue has been resolved in version 1.3.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€