chec / commercejs-nextjs-demo-store

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
https://commercejs-demo-store.netlify.app/
BSD 3-Clause "New" or "Revised" License
1.07k stars 206 forks source link

Add category in dashboard messes up a Link in CategoryBanner.js #157

Closed LB22 closed 3 years ago

LB22 commented 3 years ago

If I add a new category and refresh I get the error "Error: Failed prop type: The prop href expects a string or object in <Link>, but got undefined instead."

I traced it by luck to <Link href={item.link}> in components/homepage/CategoryBanner.js.

The error goes away if I remove the new category I created in the dashboard, or if I change the Link to <Link href="/">

robbieaverill commented 3 years ago

cc @jaepass

jaepass commented 3 years ago

Thanks for raising this @LB22, I'll look into this.

@robbieaverill I think we'll need to completely remove this category block.

robbieaverill commented 3 years ago

Sounds good. If not, we need to ensure that any attributes of the extra category data we consume in this demo store are either attributes that the Chec API provides, or have null safety handling for cases like this where we've added extra properties that don't exist in the Chec API.

jaepass commented 3 years ago

Fixed with https://github.com/chec/commercejs-nextjs-demo-store/pull/204