Skip to content

Commit

Permalink
Merge pull request #2452 from graphcommerce-org/fix/cleanup-knip
Browse files Browse the repository at this point in the history
Cleanup before release
  • Loading branch information
paales authored Dec 17, 2024
2 parents b22a6ff + 81feacd commit 8e67041
Show file tree
Hide file tree
Showing 232 changed files with 832 additions and 2,667 deletions.
2 changes: 1 addition & 1 deletion .changeset/brown-tools-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@graphcommerce/graphql': patch
---

The `<InContextMask />` component now only warns when a block is rendered during the initial SSR render.
The `<PrivateQueryMask />` component now only warns when a block is rendered during the initial SSR render.
5 changes: 5 additions & 0 deletions .changeset/forty-scissors-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/next-config': minor
---

Migrated to next.config.ts
2 changes: 1 addition & 1 deletion .changeset/odd-mails-yell.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@graphcommerce/magento-customer': patch
---

Remove the inContext directive from the query before sending to the server
Remove the privateContext directive from the query before sending to the server
9 changes: 9 additions & 0 deletions .changeset/shiny-pumpkins-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@graphcommerce/algolia-personalization': patch
'@graphcommerce/magento-customer': patch
'@graphcommerce/magento-product': patch
'@graphcommerce/magento-search': patch
'@graphcommerce/graphql': patch
---

Renamed useInContextQuery to usePrivateQuery
2 changes: 1 addition & 1 deletion .changeset/thin-teachers-try.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@graphcommerce/graphql': patch
---

When a `useInContextQuery` is called, only execute when there is no `InContextMaskContext` defined above.
When a `usePrivateQuery` is called, only execute when there is no `PrivateQueryMaskContext` defined above.
4 changes: 4 additions & 0 deletions docs/framework/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ Show a message when the product is added to the wishlist.

Debug configuration for GraphCommerce

#### cart: boolean

Enable debugging interface to debug sessions

#### pluginStatus: boolean

Reports which plugins are enabled or disabled.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InContextMaskProvider, useInContextQuery } from '@graphcommerce/graphql'
import { PrivateQueryMaskProvider, usePrivateQuery } from '@graphcommerce/graphql'
import { ProductListDocument, ProductListItemsFragment } from '@graphcommerce/magento-product'
import { ProductSpecsFragment } from '@graphcommerce/magento-product/components/ProductSpecs/ProductSpecs.gql'
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
Expand Down Expand Up @@ -41,7 +41,7 @@ export function RowProduct(props: RowProductProps) {
const mergedRenderer = { ...defaultRenderer, ...renderer } as VariantRenderer

const urlKeys = filterNonNullableKeys(items).map((item) => item.url_key)
const scoped = useInContextQuery(
const scoped = usePrivateQuery(
ProductListDocument,
{ variables: { onlyItems: true, filters: { url_key: { in: urlKeys } } } },
{ products: { items } },
Expand All @@ -58,8 +58,8 @@ export function RowProduct(props: RowProductProps) {
})

return (
<InContextMaskProvider mask={scoped.mask}>
<PrivateQueryMaskProvider mask={scoped.mask}>
<RenderType {...rest} {...products} />
</InContextMaskProvider>
</PrivateQueryMaskProvider>
)
}
7 changes: 4 additions & 3 deletions examples/magento-graphcms/graphql/ProductPage2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ query ProductPage2(
$urlKey: String!
$reviewPageSize: Int = 3
$reviewPage: Int = 1
$context: InContextInput
$context: PrivateContext
$useCustomAttributes: Boolean = false
) {
products(filter: { url_key: { eq: $urlKey } }) @inContext(context: $context) {
products(filter: { url_key: { eq: $urlKey } }) @privateContext(context: $context) {
...ProductSpecs
items {
__typename
Expand All @@ -20,7 +20,8 @@ query ProductPage2(
}
}
# Workaround for https://github.com/magento/magento2/issues/32427
relatedUpsells: products(filter: { url_key: { eq: $urlKey } }) @inContext(context: $context) {
relatedUpsells: products(filter: { url_key: { eq: $urlKey } })
@privateContext(context: $context) {
items {
uid
...UpsellProducts
Expand Down
7 changes: 1 addition & 6 deletions examples/magento-graphcms/lib/sw.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
runtimeCaching,
PrecacheEntry,
Serwist,
productionCaching,
} from '@graphcommerce/service-worker'
import { PrecacheEntry, Serwist, productionCaching } from '@graphcommerce/service-worker'

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
declare const self: ServiceWorkerGlobalScope & {
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions examples/magento-graphcms/pages/[...url].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PageOptions } from '@graphcommerce/framer-next-pages'
import { cacheFirst, flushMeasurePerf, InContextMaskProvider } from '@graphcommerce/graphql'
import { cacheFirst, flushMeasurePerf, PrivateQueryMaskProvider } from '@graphcommerce/graphql'
import { Asset, hygraphPageContent, HygraphPagesQuery } from '@graphcommerce/hygraph-ui'
import {
appendSiblingsAsChildren,
Expand Down Expand Up @@ -69,9 +69,8 @@ function CategoryPage(props: CategoryProps) {
const page = pages?.[0]
const isCategory = params && category && products?.items

console.log(page?.asset)
return (
<InContextMaskProvider mask={productList.mask}>
<PrivateQueryMaskProvider mask={productList.mask}>
<CategoryMeta
params={params}
title={page?.metaTitle}
Expand Down Expand Up @@ -161,7 +160,7 @@ function CategoryPage(props: CategoryProps) {
}}
/>
)}
</InContextMaskProvider>
</PrivateQueryMaskProvider>
)
}

Expand Down
10 changes: 5 additions & 5 deletions examples/magento-graphcms/pages/p/[url].tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PageOptions } from '@graphcommerce/framer-next-pages'
import {
cacheFirst,
InContextMaskProvider,
PrivateQueryMaskProvider,
mergeDeep,
useInContextQuery,
usePrivateQuery,
} from '@graphcommerce/graphql'
import { hygraphPageContent, HygraphPagesQuery } from '@graphcommerce/hygraph-ui'
import {
Expand Down Expand Up @@ -60,7 +60,7 @@ type GetPageStaticProps = GetStaticProps<LayoutNavigationProps, Props, RouteProp
function ProductPage(props: Props) {
const { usps, sidebarUsps, pages, defaultValues, urlKey } = props

const scopedQuery = useInContextQuery(
const scopedQuery = usePrivateQuery(
ProductPage2Document,
{ variables: { urlKey, useCustomAttributes: import.meta.graphCommerce.magentoVersion >= 247 } },
props,
Expand All @@ -75,7 +75,7 @@ function ProductPage(props: Props) {
if (!product?.sku || !product.url_key) return null

return (
<InContextMaskProvider mask={scopedQuery.mask}>
<PrivateQueryMaskProvider mask={scopedQuery.mask}>
<AddProductsToCartForm key={product.uid} defaultValues={defaultValues}>
<LayoutHeader floatingMd hideMd={import.meta.graphCommerce.breadcrumbs}>
<LayoutTitle size='small' component='span'>
Expand Down Expand Up @@ -178,7 +178,7 @@ function ProductPage(props: Props) {
productListRenderer={productListRenderer}
sx={(theme) => ({ mb: theme.spacings.xxl })}
/>
</InContextMaskProvider>
</PrivateQueryMaskProvider>
)
}

Expand Down
6 changes: 3 additions & 3 deletions examples/magento-graphcms/pages/search/[[...url]].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PageOptions } from '@graphcommerce/framer-next-pages'
import { InContextMaskProvider, cacheFirst, flushMeasurePerf } from '@graphcommerce/graphql'
import { PrivateQueryMaskProvider, cacheFirst, flushMeasurePerf } from '@graphcommerce/graphql'
import { MenuQueryFragment } from '@graphcommerce/magento-category'
import {
ProductListDocument,
Expand Down Expand Up @@ -61,7 +61,7 @@ function SearchResultPage(props: SearchResultProps) {
<ProductFiltersProSearchField size='small' formControl={{ sx: { width: '81vw' } }} />
</LayoutHeader>

<InContextMaskProvider mask={productList.mask}>
<PrivateQueryMaskProvider mask={productList.mask}>
{import.meta.graphCommerce.productFiltersPro &&
import.meta.graphCommerce.productFiltersLayout === 'SIDEBAR' && (
<ProductListLayoutSidebar {...productList} menu={menu} />
Expand All @@ -73,7 +73,7 @@ function SearchResultPage(props: SearchResultProps) {
{!import.meta.graphCommerce.productFiltersPro && (
<ProductListLayoutClassic {...productList} menu={menu} />
)}
</InContextMaskProvider>
</PrivateQueryMaskProvider>
</>
)
}
Expand Down
7 changes: 4 additions & 3 deletions examples/magento-open-source/graphql/ProductPage2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ query ProductPage2(
$urlKey: String!
$reviewPageSize: Int = 3
$reviewPage: Int = 1
$context: InContextInput
$context: PrivateContext
$useCustomAttributes: Boolean = false
) {
products(filter: { url_key: { eq: $urlKey } }) @inContext(context: $context) {
products(filter: { url_key: { eq: $urlKey } }) @privateContext(context: $context) {
...ProductSpecs
items {
__typename
Expand All @@ -20,7 +20,8 @@ query ProductPage2(
}
}
# Workaround for https://github.com/magento/magento2/issues/32427
relatedUpsells: products(filter: { url_key: { eq: $urlKey } }) @inContext(context: $context) {
relatedUpsells: products(filter: { url_key: { eq: $urlKey } })
@privateContext(context: $context) {
items {
uid
...UpsellProducts
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/magento-open-source/pages/[...url].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PageOptions } from '@graphcommerce/framer-next-pages'
import { cacheFirst, flushMeasurePerf, InContextMaskProvider } from '@graphcommerce/graphql'
import { cacheFirst, flushMeasurePerf, PrivateQueryMaskProvider } from '@graphcommerce/graphql'
import {
appendSiblingsAsChildren,
CategoryBreadcrumbs,
Expand Down Expand Up @@ -63,7 +63,7 @@ function CategoryPage(props: CategoryProps) {
const isCategory = params && category && products?.items

return (
<InContextMaskProvider mask={productList.mask}>
<PrivateQueryMaskProvider mask={productList.mask}>
<CategoryMeta params={params} {...category} />
<LayoutHeader floatingMd hideMd={import.meta.graphCommerce.breadcrumbs}>
<LayoutTitle size='small' component='span'>
Expand Down Expand Up @@ -124,7 +124,7 @@ function CategoryPage(props: CategoryProps) {
)}
</>
)}
</InContextMaskProvider>
</PrivateQueryMaskProvider>
)
}

Expand Down
Loading

0 comments on commit 8e67041

Please sign in to comment.