Add blocking fallback to pages (#357)

* Update [...pages].tsx

* Fix provider config overwrite

* Shopify changes
This commit is contained in:
cond0r
2021-06-07 23:12:20 +03:00
committed by GitHub
parent 0e804d09f9
commit 2d0c6e0c8a
6 changed files with 18 additions and 12 deletions

View File

@@ -50,18 +50,18 @@ export const handler: SWRHook<SearchProductsHook> = {
})
// filter on client when brandId & categoryId are set since is not available on collection product query
products = brandId
? data.node.products.edges.filter(
? data.node?.products?.edges?.filter(
({ node: { vendor } }: ProductEdge) =>
vendor.replace(/\s+/g, '-').toLowerCase() === brandId
)
: data.node.products.edges
: data.node?.products?.edges
} else {
const data = await fetch<GetAllProductsQuery>({
query: options.query,
method,
variables,
})
products = data.products.edges
products = data.products?.edges
}
return {