-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Error: Unable to resolve image URL from source (undefined)" -> [slug].js: image[index] == undefined #99
Comments
error debug: - catch undefined image[index]: urlFor(image && ((image[index] == undefined) ? image[0] : (image[index]))) - adrianhajdin/ecommerce_sanity_stripe#99 - https://youtu.be/q3WHdoz2KmE tutorial: https://youtu.be/4mOkFXyxfsU?t=4585
hi , @topengl I may like to suggest 2 way of this issue, 1 ) The image are loading in the sanity db right, then you fetch the image by the url ,
if you have any further error, or any doubt my happy to help you with it. |
Hey topengl check on the first lines where you're declaring your class ProductDetails, you might be missing curly braces parameters. Keep it up Buddy |
My code is like this |
youtube comment:
Hi @javascript Mastery. Am getting an error at around 1:28:00. "Error: Unable to resolve image URL from source (undefined)". The product Image cannot be rendered. and yet it works so fine in the project. I realized someone had the same issue and raised in on stack overflow, though there was no reply.
reply:
The issue for me was, that "index" in image[index] is not reset.
"index" is set by onMouseEnter={() => setIndex(i).
When I load a new Product from the "maylike-products-wrapper", which has not as many images as the actual one, then image[index] is undefined.
I am just starting with Web-development, so not sure if this is good practice here:
urlFor(image && ((image[index] == undefined) ? image[0] : (image[index])))
instead of:
urlFor(image && image[index])
For debugging I have followed these instructions: https://youtu.be/q3WHdoz2KmE
The text was updated successfully, but these errors were encountered: