-
Notifications
You must be signed in to change notification settings - Fork 683
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
ISSUE-2223: Fixed the bug with breadcrumbs on PDP with a product without categories #2224
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this PR! This definitely solves the case for when there are no categories for a product, especially since it was previously just throwing an error.
Please make the minor change to the conditional and add a comment above it as suggested.
Cheers!
@@ -97,6 +97,9 @@ const getMediaGalleryEntries = (product, optionCodes, optionSelections) => { | |||
// product has multiple related categories. This function filters and selects | |||
// one category id for that purpose. | |||
const getBreadcrumbCategoryId = categories => { | |||
if (!!categories.length === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing categories
is an empty array when we get here and there is no category assigned to a product. In that case, let's just use a simple check against truthyness of categories
and check whether there are any values in categories
array, if it exists:
// Exit if there are no categories for this product.
if (!categories || !categories.length) {
return;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewbess Thanks for contributing! Looks like a simple fix. 👍
@sirugh Agreed, good suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @sirugh
Thank you for review.
I have fixed it.
Please check.
@@ -97,6 +97,9 @@ const getMediaGalleryEntries = (product, optionCodes, optionSelections) => { | |||
// product has multiple related categories. This function filters and selects | |||
// one category id for that purpose. | |||
const getBreadcrumbCategoryId = categories => { | |||
if (!!categories.length === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewbess Thanks for contributing! Looks like a simple fix. 👍
@sirugh Agreed, good suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the suggested changes!
Description
This PR fixes the bug with breadcrumbs on PDP when a product isn't assigned anything category
Related Issue
Closes #2223.
Acceptance
Verification Stakeholders
Specification
Verification Steps
Screenshots / Screen Captures (if appropriate)