Skip to content

Commit

Permalink
Make sure the DemoRecentlyViewedProducts doesn't render without any i…
Browse files Browse the repository at this point in the history
…tems
  • Loading branch information
paales committed Jan 22, 2024
1 parent dc86f2f commit 38ec023
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-chicken-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphcommerce/demo-magento-graphcommerce": patch
---

Make sure the DemoRecentlyViewedProducts doesn't render without any items
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@ function DemoRecentlyViewedProducts(props: PluginProps<RecentlyViewedProductsPro
return (
<>
<Box ref={ref} className='recentlyViewedProducts' sx={{ height: '1px' }} />
<AddProductsToCartForm>
<SidebarSlider sidebar={<Typography variant='h2'>{title}</Typography>}>
{filterNonNullableKeys(items).map((item) => (
<RenderType
key={item.uid}
renderer={productListRenderer}
sizes={responsiveVal(200, 400)}
titleComponent='h3'
{...item}
/>
))}
</SidebarSlider>
</AddProductsToCartForm>
{items.length > 0 && (
<AddProductsToCartForm>
<SidebarSlider sidebar={<Typography variant='h2'>{title}</Typography>}>
{filterNonNullableKeys(items).map((item) => (
<RenderType
key={item.uid}
renderer={productListRenderer}
sizes={responsiveVal(200, 400)}
titleComponent='h3'
{...item}
/>
))}
</SidebarSlider>
</AddProductsToCartForm>
)}
</>
)
}
Expand Down

0 comments on commit 38ec023

Please sign in to comment.