Skip to content

Commit

Permalink
Merge 60ad5a0 into a335be4
Browse files Browse the repository at this point in the history
  • Loading branch information
lbebber committed Mar 4, 2020
2 parents a335be4 + 60ad5a0 commit 3ccc6c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Error caused by wrong hooks order on ProductSummaryList

## [2.52.0] - 2020-03-03
### Added
Expand Down
16 changes: 8 additions & 8 deletions react/ProductSummaryList.js
Expand Up @@ -67,8 +67,8 @@ const ProductSummaryList = ({
category,
...(collection != null
? {
collection,
}
collection,
}
: {}),
specificationFilters: specificationFilters.map(parseFilters),
orderBy,
Expand All @@ -80,15 +80,10 @@ const ProductSummaryList = ({
},
})

// https://github.com/vtex-apps/product-summary/issues/235
if (loading || error) {
return null
}

const { list } = useListContext()
const { treePath } = useTreePath()

const { products } = data
const { products } = data || {}

const newListContextValue = useMemo(() => {
const componentList =
Expand All @@ -108,6 +103,11 @@ const ProductSummaryList = ({
return list.concat(componentList)
}, [products, treePath, list])

// https://github.com/vtex-apps/product-summary/issues/235
if (loading || error) {
return null
}

return (
<ListContextProvider list={newListContextValue}>
{children}
Expand Down

0 comments on commit 3ccc6c1

Please sign in to comment.