SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
285 stars 138 forks source link

[BUG] By "throw new HTTPNotFound" we don't render "PageNotFound" page #998

Open MykolaShkut-melon opened 1 year ago

MykolaShkut-melon commented 1 year ago

Summary

All 404 pages should have the same design

Short summary of what is going on or to provide context.

Steps To Reproduce

Open some product pages with no existing product id for example https://pwa-kit.mobify-storefront.com/product/aaa

Expected result

render the HTML of the PageNotFound page component with header and footer shot_2023-02-22_12-50-58

Describe what should have happened.

Actual result

But now we see an error page generated with _error/index.jsx shot_2023-02-22_12-46-49

git2gus[bot] commented 1 year ago

This issue has been linked to a new work item: W-12586787

bendvc commented 1 year ago

Hi @MykolaShkut-melon

Are you seeing a difference in the SDK version you generated your project with and the one you reported this issue on? The way errors are handled is very different when you are talking about a routing match and throwing them in render or getProps.

I tried generating a project with version 2.2.0 and it behaved the same to our latest 2.7.0 version. I'm only asking so I know to treat this as a regression/bug or a request.

A side note. The template-retail-react-app was created as a starting point for developing your storefront, and we didn't implement customized error handling for pages like product-detail or product-list. As a result we simply throw and error and let the catch all error handler do its thing. We expect that project implementors would handle product not found errors in a customized way. For example, if you want the behaviour of retaining the app "chrome", you can remove the throw logic from get props and instead render a custom error component in the render portion of the product-detail page.

Anyway.. looking forward to hearing back from you, and we can discuss this more. 👍