Skip to content

Commit

Permalink
make prod-summary list consume products query
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfidelis committed Feb 21, 2020
1 parent d7c47b0 commit d2e9685
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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]
### Changed
- `ProductSummaryList`: Consume new products query.

## [2.51.5] - 2020-02-21
### Changed
Expand Down
11 changes: 5 additions & 6 deletions react/ProductSummaryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useListContext, ListContextProvider } from 'vtex.list-context'
import { mapCatalogProductToProductSummary } from './utils/normalize'
import ProductListEventCaller from './components/ProductListEventCaller'

import productSearchV2 from 'vtex.store-resources/QueryProductSearchV2'
import productsQuery from 'vtex.store-resources/QueryProducts'

const ORDER_BY_OPTIONS = {
RELEVANCE: {
Expand Down Expand Up @@ -59,10 +59,9 @@ const ProductSummaryList = ({
orderBy = ORDER_BY_OPTIONS.TOP_SALE_DESC.value,
specificationFilters = [],
maxItems = 10,
withFacets = false,
skusFilter,
}) => {
const { data, loading, error } = useQuery(productSearchV2, {
ssr: true,
const { data, loading, error } = useQuery(productsQuery, {
name: 'productList',
variables: {
category,
Expand All @@ -76,7 +75,7 @@ const ProductSummaryList = ({
from: 0,
to: maxItems - 1,
hideUnavailableItems,
withFacets,
skusFilter,
},
})

Expand All @@ -88,7 +87,7 @@ const ProductSummaryList = ({
const { list } = useListContext()
const { treePath } = useTreePath()

const products = data.productSearch && data.productSearch.products
const { products } = data

const newListContextValue = useMemo(() => {
const componentList =
Expand Down

0 comments on commit d2e9685

Please sign in to comment.