Skip to content

Commit

Permalink
Upgraded to @apollo/client 3.12.3 without impacting typescript compil…
Browse files Browse the repository at this point in the history
…ation performance.
  • Loading branch information
paales committed Jan 6, 2025
1 parent 1cf7c95 commit 8015eab
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .changeset/wicked-planets-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphcommerce/hygraph-dynamic-rows': patch
'@graphcommerce/react-hook-form': patch
'@graphcommerce/graphql': patch
---

Upgraded to @apollo/client 3.12.3 without impacting typescript compilation performance.
2 changes: 1 addition & 1 deletion examples/magento-graphcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"create-patch": "patch-package --exclude 'package.json$|gql.ts$|interceptor.tsx$'"
},
"dependencies": {
"@apollo/client": "3.11.10",
"@apollo/client": "~3.12.3",
"@emotion/cache": "^11.13.1",
"@emotion/react": "11.12.0",
"@emotion/server": "^11.11.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/magento-open-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"create-patch": "patch-package --exclude 'package.json$|gql.ts$|interceptor.tsx$'"
},
"dependencies": {
"@apollo/client": "3.11.10",
"@apollo/client": "~3.12.3",
"@emotion/cache": "^11.13.1",
"@emotion/react": "11.12.0",
"@emotion/server": "^11.11.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"remark": "^15.0.1"
},
"devDependencies": {
"@apollo/client": "3.11.10",
"@apollo/client": "~3.12.3",
"@graphcommerce/cli": "workspace:^",
"@graphcommerce/eslint-config-pwa": "workspace:^",
"@graphcommerce/graphql-mesh": "workspace:^",
Expand Down
6 changes: 6 additions & 0 deletions packages/graphql/apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ export * from '@apollo/client/link/error'
export * from '@apollo/client/utilities'

export { getOperationName } from '@apollo/client/utilities'

declare module '@apollo/client' {
interface DataMasking {
enabled: true
}
}
4 changes: 2 additions & 2 deletions packages/graphql/hooks/usePrivateQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useIsSSR } from '@graphcommerce/next-ui/hooks/useIsSsr'
// eslint-disable-next-line import/no-extraneous-dependencies
import { getCssFlag, removeCssFlag, setCssFlag } from '@graphcommerce/next-ui/utils/cssFlags'
import { useContext, useEffect } from 'react'
import type { QueryHookOptions, QueryResult, TypedDocumentNode } from '../apollo'
import type { MaybeMasked, QueryHookOptions, QueryResult, TypedDocumentNode } from '../apollo'
import { useQuery } from '../apollo'
import { PrivateQueryMaskContext } from '../components/PrivateQueryMask/PrivateQueryMask'
import { usePrivateQueryContext } from './usePrivateQueryContext'
Expand Down Expand Up @@ -32,7 +32,7 @@ export function usePrivateQuery<
document: TypedDocumentNode<Q, V>,
options: QueryHookOptions<Q, V>,
unscopedResult: Q,
): Omit<QueryResult<Q, V>, 'data'> & { data: Q; mask: boolean } {
): Omit<QueryResult<Q, V>, 'data'> & { data: Q | NonNullable<MaybeMasked<Q>>; mask: boolean } {
const { skip = true } = options
const context = usePrivateQueryContext()
const isSsr = useIsSSR()
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"dependencies": {
"@apollo/client": "3.11.10",
"@apollo/client": "~3.12.3",
"@graphql-codegen/add": "5.0.3",
"@graphql-codegen/fragment-matcher": "5.0.2",
"@graphql-codegen/introspection": "4.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/hygraph-dynamic-rows-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"dev": "next dev"
},
"dependencies": {
"@apollo/client": "3.11.10",
"@graphcommerce/next-config": "9.0.4-canary.2",
"@apollo/client": "~3.12.3",
"@graphcommerce/next-config": "9.0.4-canary.0",
"@hygraph/app-sdk-react": "^0.0.5",
"@lingui/conf": "4.14.1",
"@lingui/core": "4.14.1",
Expand Down
8 changes: 6 additions & 2 deletions packages/react-hook-form/src/useFormGql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
FetchResult,
LazyQueryHookOptions,
LazyQueryResultTuple,
MaybeMasked,
MutationHookOptions,
MutationTuple,
TypedDocumentNode,
Expand All @@ -16,7 +17,10 @@ import type { UseGqlDocumentHandler } from './useGqlDocumentHandler'
import { useGqlDocumentHandler } from './useGqlDocumentHandler'
import { tryAsync } from './utils/tryTuple'

export type OnCompleteFn<Q, V> = (data: FetchResult<Q>, variables: V) => void | Promise<void>
export type OnCompleteFn<Q, V> = (
data: FetchResult<MaybeMasked<Q>>,
variables: V,
) => void | Promise<void>

type UseFormGraphQLCallbacks<Q, V> = {
/**
Expand Down Expand Up @@ -84,7 +88,7 @@ export type UseFormGqlMethods<Q, V extends FieldValues> = Omit<
'encode' | 'type'
> &
Pick<UseFormReturn<V>, 'handleSubmit'> & {
data?: Q | null
data?: MaybeMasked<Q> | null
error?: ApolloError
submittedVariables?: V
}
Expand Down

0 comments on commit 8015eab

Please sign in to comment.