Skip to content
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

Fix console error for products without variants #3351

Merged
merged 3 commits into from
Dec 8, 2017

Conversation

iakhator
Copy link

Resolve #3349

PR resolve console error displayed when variant does not exist in the PDP. This actually happens because the product variant value is empty hence a check is placed to make sure variant exists before checking for indexOf

Test

  • Create a new product
  • Go to your database GUI and delete the variant instance of the new product
  • Do not refresh the product grid page
  • Visit the product grid and click on the product created above
  • Observe the browser console to see no error displayed

Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look more closely at the values you are checking for and when

}

return false;
if (current.ancestors) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've introduced a possible failure here because you are checking for current.ancestors before checking if current exists as is done below.

@iakhator iakhator force-pushed the console-error-without-variant-3349 branch from 1483f9e to 5403c51 Compare November 28, 2017 09:05
@iakhator
Copy link
Author

I will always have this in mind. Thanks

@brent-hoover
Copy link
Collaborator

Tested and it works, just wondering if we could simplify the code a little.

@iakhator
Copy link
Author

alright, I will work on it

@spencern spencern changed the base branch from master to release-1.6.1 December 8, 2017 18:49
@spencern spencern merged commit 4af5126 into release-1.6.1 Dec 8, 2017
@spencern spencern deleted the console-error-without-variant-3349 branch December 8, 2017 18:49
@spencern spencern mentioned this pull request Dec 12, 2017
Akarshit pushed a commit that referenced this pull request Jan 7, 2018
…variant-3349

Fix console error for products without variants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants