bradtraversy / proshop-v2

ProShop ecommerce website built with MERN & Redux Toolkit
532 stars 267 forks source link

Unexpected Application Error! Cannot read properties of undefined (reading 'length') #9

Closed sajadhn1988 closed 11 months ago

sajadhn1988 commented 1 year ago

Unexpected Application Error! Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') at Header (http://localhost:3000/static/js/bundle.js:680:51) at renderWithHooks (http://localhost:3000/static/js/bundle.js:52269:22) at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:55555:17) at beginWork (http://localhost:3000/static/js/bundle.js:56851:20) at beginWork$1 (http://localhost:3000/static/js/bundle.js:61814:18) at performUnitOfWork (http://localhost:3000/static/js/bundle.js:61083:16) at workLoopSync (http://localhost:3000/static/js/bundle.js:61006:9) at renderRootSync (http://localhost:3000/static/js/bundle.js:60979:11) at recoverFromConcurrentError (http://localhost:3000/static/js/bundle.js:60471:24) at performConcurrentWorkOnRoot (http://localhost:3000/static/js/bundle.js:60383:26) ๐Ÿ’ฟ Hey developer ๐Ÿ‘‹

You can provide a way better UX than this when your app throws errors by providing your own ErrorBoundary or errorElement prop on your route.

sajadhn1988 commented 1 year ago

Unexpected Application Error! Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') at Header (http://localhost:3000/static/js/bundle.js:680:51) at renderWithHooks (http://localhost:3000/static/js/bundle.js:52269:22) at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:55555:17) at beginWork (http://localhost:3000/static/js/bundle.js:56851:20) at beginWork$1 (http://localhost:3000/static/js/bundle.js:61814:18) at performUnitOfWork (http://localhost:3000/static/js/bundle.js:61083:16) at workLoopSync (http://localhost:3000/static/js/bundle.js:61006:9) at renderRootSync (http://localhost:3000/static/js/bundle.js:60979:11) at recoverFromConcurrentError (http://localhost:3000/static/js/bundle.js:60471:24) at performConcurrentWorkOnRoot (http://localhost:3000/static/js/bundle.js:60383:26) ๐Ÿ’ฟ Hey developer ๐Ÿ‘‹

You can provide a way better UX than this when your app throws errors by providing your own ErrorBoundary or errorElement prop on your route.

consider the following: cartItems && cartItems.length === 0

bushblade commented 11 months ago

Hi @sajadhn1988 Are you a student of Brads? If so can you post in the course Q&A or over on Brads Discord server please, make sure to include a link to your projects repository. If you're not a student then can you tell me if this is using the repository code or your own project?

bushblade commented 11 months ago

Closing due to lack of information and not able to reproduce using repository code.