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

TypeError: Cannot read properties of undefined (reading 'map') #225

Closed mattmi91 closed 3 years ago

mattmi91 commented 3 years ago

I get this error everytime I go from page to page, how to solve? .next\static\chunks\pages\collection.js (50:20) @ Collections.renderSidebar

48 | return ( 49 | <>

50 | {categories.map(category => ( | ^ 51 |

52 |
53 |

robbieaverill commented 3 years ago

Hi @mattmi91, did you find a solution for this?

mattmi91 commented 3 years ago

yes I ended up changing line 50 and 102 to this {categories && categories.map(category => ( the categories && was the solution but I now have another problem my products do not show up on that collection page but they do on the home page so my my api key is working but not for the collection page?

robbieaverill commented 3 years ago

Feel free to join our community Slack channel for integration support: http://slack.commercejs.com.

Regarding the categories patch, if you want to make a pull request to update this repository with that change we'd welcome that 🙂

mattmi91 commented 3 years ago

Feel free to join our community Slack channel for integration support: http://slack.commercejs.com.

Regarding the categories patch, if you want to make a pull request to update this repository with that change we'd welcome that 🙂

mattmi91 commented 3 years ago

Feel free to join our community Slack channel for integration support: http://slack.commercejs.com.

Regarding the categories patch, if you want to make a pull request to update this repository with that change we'd welcome that 🙂

im guessing they are not showing because I had to make that change to stop getting the error right when the page loads?