-
Notifications
You must be signed in to change notification settings - Fork 71
fix: B2C-1063 product details variant details pages #197
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
base: development
Are you sure you want to change the base?
fix: B2C-1063 product details variant details pages #197
Conversation
… category display
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| /> | ||
| ))} | ||
| {attribute_values | ||
| .filter((attribute) => attribute != null) |
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.
how about .filter(Boolean) ?
| <SectionRow | ||
| title={t("products.fields.primaryCategory.label")} | ||
| value={ | ||
| product.categories?.length |
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 suggest checking length this way
!!product.categories?.length to exclude empty arrays
| <SectionRow | ||
| title={t("products.fields.secondaryCategories.label")} | ||
| value={ | ||
| product.secondary_categories?.length |
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 suggest checking length this way
!!product.categories?.length to exclude empty arrays
…in product detail sections
…duct-details-variant-details-pages
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.
imo it'll better fit if you use kebab-case here
| const { attribute_values } = product | ||
|
|
||
| const { attributes, isLoading } = useProductAttributes(product.id) | ||
|
|
||
| const attributeList = useMemo(() => { | ||
| return attributes?.map((attribute) => { | ||
| const value = | ||
| product.attribute_values?.filter(Boolean).find((av) => av.attribute_id === attribute.id) | ||
| ?.value || "-" | ||
| return { | ||
| ...attribute, |
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.
- useMemo seems unnecessary and maybe a little bit risky here, so i suggest to not use it
- do we need this .filter(Boolean) here actually? how about just optional chaining
| <SectionRow | ||
| key={attribute.id} | ||
| title={attribute.attribute.name} | ||
| value={attribute.value} |
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.
if we're getting attributes from BE is there a chance to get empty value? so do we need this bool filter actually?
|
@mikolvj @kacpergumieniuk |
|
@mikolvj @kacpergumieniuk conflict |
No description provided.