fix(search): add missing default product relations (#4008)

* fix(search): add missing default product relations

Add missing default product relations for events calling SearchService.addDocuments

For the following events: `ProductService.Events.UPDATED,  ProductVariantService.Events.CREATED, ProductVariantService.Events.UPDATED]`,
`SearchService.addDocuments` will fail due to `product` missing its `variants` relations.

The issue can be observed with the Algolia plugin where `reduce` is being attempted on `product.variants`.
https://github.com/medusajs/medusa/blob/develop/packages/medusa-plugin-algolia/src/utils/transformer.ts#L14

Implement the same retrieve pattern as `handleProductCreation` method.

* chore(changeset): patch

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
patpich
2023-05-05 07:04:56 -04:00
committed by GitHub
parent bd53adb238
commit ff37cd190f
2 changed files with 11 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
fix(search): add missing default product relations