SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 388 forks source link

Failed products/{code} request is not retried when opening the product page a second time #12794

Open StNimmerlein opened 3 years ago

StNimmerlein commented 3 years ago

Describe the bug When opening the product page, a request ist made to the backend to retrieve the product details (/occ/v2/{store}/products/{code}). When this request fails and the details page to this product is opened a second time, the request is not retried and the page stays empty, even if the request would succeed now.

Tell us the version of Spartacus

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://spartacus-training.eastus.cloudapp.azure.com/electronics-spa/en/USD/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584'
  2. Open the network tab in the browser dev tools
  3. Click on the first product
  4. Find the corresponding request to the backend for this product in the network tab (e.g. https://spartacus-training.eastus.cloudapp.azure.com:8443/occ/v2/electronics-spa/products/1776948?fields=classifications&lang=en&curr=USD)
  5. Right click this entry and select "Block request URL"
  6. Go back to 'https://spartacus-training.eastus.cloudapp.azure.com/electronics-spa/en/USD/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584' and reload the page (to clear the store)
  7. Once again click the first entry. Now the details page stays empty since the request is blocked.
  8. Go back to 'https://spartacus-training.eastus.cloudapp.azure.com/electronics-spa/en/USD/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584' without reloading the page (to keep the store).
  9. Unblock the previously blocked URL in your browser.
  10. Click the first entry again. The details page stays empty and no new attempt is made to load the product data now (no new request to the backend).

Expected behavior When the request to the backend fails, it is retried the next time I visit the details page.

Desktop (please complete the following information):

giancorderoortiz commented 3 years ago

Investigate if a workaround is possible.