adrianhajdin / ecommerce_sanity_stripe

Modern Full Stack ECommerce Application with Stripe
https://jsmastery.pro
2.21k stars 674 forks source link

cannot read properties of null (reading 'current') #45

Open Priyanshsharma21 opened 2 years ago

Priyanshsharma21 commented 2 years ago

Keep getting this error in slug.current, I spend large time on this please help with this slug.current is undefined here

Paytrix commented 2 years ago

What exactly is your problem?

When and where does it happen? What files are you talking about?

async-dime commented 2 years ago

I got that error also previously, specifically when rendering maylike products (1:37:50 on video)

Screenshot from 2022-10-20 20-59-58

After I checked back, there is an asterisk (*) missing in my productsQuery inside getStaticProps,

inside pages > product > [slug].js

(before) export const getStaticProps = async ({ params: { slug } }) => { ... const productsQuery = '[_type == "product"]'; ... };

(after) export const getStaticProps = async ({ params: { slug } }) => { ... const productsQuery = '*[_type == "product"]'; ... };