@graphcommerce/graphql 3.4.1 → 3.4.4

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,26 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1578](https://github.com/graphcommerce-org/graphcommerce/pull/1578) [`49370878a`](https://github.com/graphcommerce-org/graphcommerce/commit/49370878a48b90a4579026a7c56c54f97840cebb) Thanks [@paales](https://github.com/paales)! - Apollo client cache is restored during development when it has encountered a runtime error
8
+
9
+ ## 3.4.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1562](https://github.com/graphcommerce-org/graphcommerce/pull/1562) [`01f1588c9`](https://github.com/graphcommerce-org/graphcommerce/commit/01f1588c9200bb39dd61146e260bfa2b32060612) Thanks [@paales](https://github.com/paales)! - The context was missing in apollo client
14
+
15
+ - Updated dependencies [[`475d23197`](https://github.com/graphcommerce-org/graphcommerce/commit/475d23197a6ce4b08cc325f872834ca592aa28dc)]:
16
+ - @graphcommerce/graphql-codegen-near-operation-file@3.0.16
17
+
18
+ ## 3.4.2
19
+
20
+ ### Patch Changes
21
+
22
+ - [#1553](https://github.com/graphcommerce-org/graphcommerce/pull/1553) [`1afc6a547`](https://github.com/graphcommerce-org/graphcommerce/commit/1afc6a5473d6e31f47b5d0188801803b31865290) Thanks [@NickdeK](https://github.com/NickdeK)! - Remove unused useClientQuery
23
+
3
24
  ## 3.4.1
4
25
 
5
26
  ### Patch Changes
@@ -7,10 +7,6 @@ import { getTypePoliciesVersion } from './typePolicies'
7
7
  const APOLLO_CACHE_PERSIST = 'apollo-cache-persist'
8
8
  const APOLLO_CACHE_VERSION = 'apollo-cache-version'
9
9
 
10
- let persistor: CachePersistor<NormalizedCacheObject> | undefined
11
-
12
- export const persistCache = () => persistor?.persist()
13
-
14
10
  /** Revives the cache from the localStorage if it is available. */
15
11
  export function createCacheReviver(
16
12
  client: ApolloClient<NormalizedCacheObject>,
@@ -22,14 +18,12 @@ export function createCacheReviver(
22
18
  let state = incommingState
23
19
  const typePoliciesVersion = getTypePoliciesVersion(policies)
24
20
 
25
- if (persistor) return
26
-
27
21
  if (typeof window !== 'undefined') {
28
22
  try {
29
23
  const { cache } = client
30
24
 
31
25
  // todo https://github.com/apollographql/apollo-cache-persist/tree/master/examples/react-native/src/utils/persistence
32
- persistor = new CachePersistor({
26
+ const persistor = new CachePersistor({
33
27
  cache,
34
28
  storage: new LocalStorageWrapper(window.localStorage),
35
29
  maxSize: false,
package/index.ts CHANGED
@@ -11,4 +11,3 @@ 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.4.1",
5
+ "version": "3.4.4",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@apollo/client": "^3.6.9",
23
- "@graphcommerce/graphql-codegen-near-operation-file": "3.0.15",
23
+ "@graphcommerce/graphql-codegen-near-operation-file": "3.0.16",
24
24
  "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.9",
25
25
  "@graphql-codegen/add": "3.2.0",
26
26
  "@graphql-codegen/fragment-matcher": "3.3.0",
@@ -1,15 +0,0 @@
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
- }