reaction
reaction copied to clipboard
Missing xForm for cartItem Media
Issue Description
There currently is no functionality to resolve cart item images, therefore these are not available in a cart query.
Background
Until v3.5.0 this xform was part of the cart: https://github.com/reactioncommerce/reaction/blob/v3.5.0/src/core-services/cart/xforms/xformCartItems.js
When @aldeed refactored that logic in https://github.com/reactioncommerce/reaction/commit/da6502d201ad749f089a8391b38f921a53f822b1 that cart xform would only call registered functions of type xformCartItems
while the actual logic was moved to the files plugin where such a function was registered.
So in v3.6.0 we had: The xform on the cart: https://github.com/reactioncommerce/reaction/blob/v3.6.0/src/core-services/cart/xforms/xformCartItems.js The actuall functionality here: https://github.com/reactioncommerce/reaction/blob/v3.6.0/src/core-services/files/util/xformItemsAddImageUrls.js
It seems like this got lost when things were moved to separate modules.
api-plugin-carts still contains that same call context.getFunctionsOfType("xformCartItems")
but the files plugin doesn't register such a function anymore: https://github.com/reactioncommerce/api-plugin-files/blob/8ed90d8901b91940266979906286a09d24aa35b5/src/index.js#L34:L36
Looking at the other functions in v3.6.0 I wonder what else might be afffected, as there were 3 other functions aswell and only startup
is left now:
https://github.com/reactioncommerce/reaction/blob/19cd5a6007bd53d73f753d8cd8fd9e941562c849/src/core-services/files/index.js#L36:L42
Steps to Reproduce
- Add item to cart
- CartItem has no image,
imageUrls
returnsnull
.
Possible Solution
Register a function of type xformCartItems
that provides the images.
Versions
v1.0.0 - trunk