@graphcommerce/graphql 3.2.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1552](https://github.com/graphcommerce-org/graphcommerce/pull/1552) [`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce) Thanks [@paales](https://github.com/paales)! - Updated to Next.js v12.2.2 and other packages and made compatible
8
+
9
+ - Updated dependencies [[`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce)]:
10
+ - @graphcommerce/graphql-codegen-near-operation-file@3.0.15
11
+ - @graphcommerce/graphql-codegen-relay-optimizer-plugin@3.0.9
12
+
13
+ ## 3.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#1544](https://github.com/graphcommerce-org/graphcommerce/pull/1544) [`5f927ebdc`](https://github.com/graphcommerce-org/graphcommerce/commit/5f927ebdc6f0331833e02b96e4f169bfe475ac6b) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Fixed hydration errors on account, cart and wishlist
18
+
19
+ ## 3.3.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#1524](https://github.com/graphcommerce-org/graphcommerce/pull/1524) [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2) Thanks [@paales](https://github.com/paales)! - Add errorLink while in development mode to allow for better error reporting when sending faulty queries to backends
24
+
3
25
  ## 3.2.1
4
26
 
5
27
  ### Patch Changes
@@ -0,0 +1,15 @@
1
+ import { useQuery as useQueryApollo } from '@apollo/client'
2
+ import { useEffect, useState } from 'react'
3
+
4
+ // eslint-disable-next-line prefer-const, import/no-mutable-exports
5
+ export const useClientQuery: typeof useQueryApollo = (query, options) => {
6
+ const [firstRender, setFirstRender] = useState(true)
7
+
8
+ const response = useQueryApollo(query, options)
9
+
10
+ useEffect(() => {
11
+ if (firstRender) setFirstRender(false)
12
+ }, [firstRender])
13
+
14
+ return response
15
+ }
package/errorLink.ts CHANGED
@@ -1,29 +1,27 @@
1
1
  import { onError } from '@apollo/client/link/error'
2
2
 
3
3
  export const errorLink = onError(({ graphQLErrors, networkError, operation }) => {
4
- if (process.env.NODE_ENV !== 'production') {
5
- if (graphQLErrors)
6
- console.error(
7
- `[GraphQL errors]: ${graphQLErrors
8
- .map(({ message, path }) => `${message} ${path?.join(',')}`)
9
- .join(', ')}`,
10
- )
4
+ if (graphQLErrors)
5
+ console.error(
6
+ `[GraphQL errors]: ${graphQLErrors
7
+ .map(({ message, path }) => `${message} ${path?.join(',')}`)
8
+ .join(', ')}`,
9
+ )
11
10
 
12
- if (networkError)
13
- console.error(`[Graphql error]: ${networkError}`)
11
+ if (networkError)
12
+ console.error(`[Graphql error]: ${networkError}`)
14
13
 
15
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
16
- ;(async () => {
17
- const graphql = await import('graphql')
14
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
15
+ ;(async () => {
16
+ const graphql = await import('graphql')
18
17
 
19
- const gqlString = graphql
20
- .print(operation.query)
21
- .toString()
22
- .replace(/(\r\n|\n|\r)/gm, ' ')
23
- .replace(/\s\s+/g, ' ')
18
+ const gqlString = graphql
19
+ .print(operation.query)
20
+ .toString()
21
+ .replace(/(\r\n|\n|\r)/gm, ' ')
22
+ .replace(/\s\s+/g, ' ')
24
23
 
25
- console.error(`[GraphQL operation]: ${gqlString}`)
26
- console.error(`[GraphQL variables]: ${JSON.stringify(operation.variables)}`)
27
- })()
28
- }
24
+ console.error(`[GraphQL operation]: ${gqlString}`)
25
+ console.error(`[GraphQL variables]: ${JSON.stringify(operation.variables)}`)
26
+ })()
29
27
  })
package/index.ts CHANGED
@@ -11,3 +11,4 @@ export * from './createCacheReviver'
11
11
 
12
12
  export * from './apollo'
13
13
  export * from './types'
14
+ export * from './apollo-hooks/useClientQuery'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphql",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "3.2.1",
5
+ "version": "3.4.1",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",
@@ -13,25 +13,29 @@
13
13
  }
14
14
  },
15
15
  "devDependencies": {
16
- "@graphcommerce/eslint-config-pwa": "^4.1.8",
16
+ "@graphcommerce/eslint-config-pwa": "^4.1.9",
17
17
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
18
- "@graphcommerce/typescript-config-pwa": "^4.0.3",
18
+ "@graphcommerce/typescript-config-pwa": "^4.0.4",
19
19
  "@playwright/test": "^1.21.1"
20
20
  },
21
21
  "dependencies": {
22
- "@apollo/client": "^3.6.6",
23
- "@graphcommerce/graphql-codegen-near-operation-file": "3.0.14",
24
- "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.8",
25
- "@graphql-codegen/add": "3.1.1",
26
- "@graphql-codegen/fragment-matcher": "3.2.1",
27
- "@graphql-codegen/introspection": "2.1.1",
28
- "@graphql-codegen/schema-ast": "2.4.1",
29
- "@graphql-codegen/typed-document-node": "2.2.12",
30
- "@graphql-codegen/typescript": "2.5.0",
31
- "@graphql-codegen/typescript-apollo-client-helpers": "2.1.19",
32
- "@graphql-codegen/typescript-document-nodes": "2.2.12",
33
- "@graphql-codegen/typescript-operations": "2.4.1",
34
- "apollo3-cache-persist": "^0.14.0",
22
+ "@apollo/client": "^3.6.9",
23
+ "@graphcommerce/graphql-codegen-near-operation-file": "3.0.15",
24
+ "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.9",
25
+ "@graphql-codegen/add": "3.2.0",
26
+ "@graphql-codegen/fragment-matcher": "3.3.0",
27
+ "@graphql-codegen/introspection": "2.2.0",
28
+ "@graphql-codegen/schema-ast": "2.5.0",
29
+ "@graphql-codegen/typed-document-node": "2.3.1",
30
+ "@graphql-codegen/typescript": "2.7.1",
31
+ "@graphql-codegen/typescript-apollo-client-helpers": "2.2.1",
32
+ "@graphql-codegen/typescript-document-nodes": "2.3.1",
33
+ "@graphql-codegen/typescript-operations": "2.5.1",
34
+ "apollo3-cache-persist": "^0.14.1",
35
35
  "graphql": "16.5.0"
36
+ },
37
+ "peerDependencies": {
38
+ "react": "^18.0.0",
39
+ "react-dom": "^18.0.0"
36
40
  }
37
41
  }