intershop-pwa icon indicating copy to clipboard operation
intershop-pwa copied to clipboard

provide shopping facade method that can fetch the product information for multiple products

Open shauke opened this issue 3 years ago • 3 comments

Describe the desired solution.

It would be nice for projects if our shopping.facade.ts would already provide a method that could fetch the product information for multiple product SKUs in one step, e.g. products$(skus: string[]).

Describe alternatives you've considered.

Currently one has to trigger product$(sku: string | Observable<string>, level: ProductCompletenessLevel | true) for each product of interest individually within a loop over the product SKUs array.

Provide additional context.

A current implementation would internally require to trigger individual products REST calls as long as ICM does not provide a REST API that would return the product information for multiple products requested by SKU. But this should not prevent working on this issue and refactoring the facade method once ICM provides an optimized REST API.

AB#79385

shauke avatar Jul 01 '21 13:07 shauke

@shauke This method was actually there before the product context refactoring, but there is just no need for this. If at any given point in time the ICM Rest API would support a call to fetch multiple products at once, it is easier to solve it in an effect by window'ing over all product load requests and make a combined call. When using product contexts, you also should never directly access the product$() method of the shopping facade but instead use *ngFor with ishProductContext, which in turn fetches the data for you.

dhhyi avatar Jul 01 '21 13:07 dhhyi

ICM internal request to provide a multiple SKUs REST API call: https://dev.azure.com/intershop-com/Products/_workitems/edit/64436 https://dev.azure.com/intershop-com/Products/_workitems/edit/54822

shauke avatar Jul 01 '21 17:07 shauke

Waiting for ICM REST API to provide the needed functionality. Once it is available #766 could be updated, tested and merged.

shauke avatar Sep 06 '22 13:09 shauke