Skip to content

Commit

Permalink
Merge pull request #239 from vtex-apps/feat/products
Browse files Browse the repository at this point in the history
make prod-summary list consume products query
  • Loading branch information
jgfidelis committed Mar 2, 2020
2 parents 127953f + d2e9685 commit 2404fa4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 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]
### Changed
- `ProductSummaryList`: Consume new products query.

## [2.51.6] - 2020-02-28
### Fixed
Expand Down
11 changes: 5 additions & 6 deletions react/ProductSummaryList.js
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 2404fa4

Please sign in to comment.