@graphcommerce/graphql 3.0.4 → 3.0.7

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,34 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1378](https://github.com/graphcommerce-org/graphcommerce/pull/1378) [`b610a6e40`](https://github.com/graphcommerce-org/graphcommerce/commit/b610a6e4049e8c9e8b5d2aeff31b8e1bfc24abe5) Thanks [@paales](https://github.com/paales)! - Pin all versions internally so we can’t end up in an unfixable state for the user
8
+
9
+ ## 3.0.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1368](https://github.com/graphcommerce-org/graphcommerce/pull/1368) [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a) Thanks [@paales](https://github.com/paales)! - playwright waitForGraphQlResponse shouldn’t crash on non-graphql responses
14
+
15
+ * [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
16
+
17
+ - [#1368](https://github.com/graphcommerce-org/graphcommerce/pull/1368) [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a) Thanks [@paales](https://github.com/paales)! - Do not recreate client cache when initialized once, fixes issue where the localStorage wasn't updated yet when a new page is loaded.
18
+
19
+ - Updated dependencies [[`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9)]:
20
+ - @graphcommerce/graphql-codegen-near-operation-file@3.0.9
21
+ - @graphcommerce/graphql-codegen-relay-optimizer-plugin@3.0.6
22
+
23
+ ## 3.0.5
24
+
25
+ ### Patch Changes
26
+
27
+ - [#1341](https://github.com/graphcommerce-org/graphcommerce/pull/1341) [`2e29c5852`](https://github.com/graphcommerce-org/graphcommerce/commit/2e29c585247d356e3027be92beb7815f2070c855) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
28
+
29
+ - Updated dependencies [[`2e29c5852`](https://github.com/graphcommerce-org/graphcommerce/commit/2e29c585247d356e3027be92beb7815f2070c855)]:
30
+ - @graphcommerce/graphql-codegen-near-operation-file@3.0.7
31
+
3
32
  ## 3.0.4
4
33
 
5
34
  ### Patch Changes
@@ -7,6 +7,10 @@ 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
+
10
14
  /** Revives the cache from the localStorage if it is available. */
11
15
  export function createCacheReviver(
12
16
  client: ApolloClient<NormalizedCacheObject>,
@@ -18,10 +22,12 @@ export function createCacheReviver(
18
22
  let state = incommingState
19
23
  const typePoliciesVersion = getTypePoliciesVersion(policies)
20
24
 
25
+ if (persistor) return
26
+
21
27
  if (typeof window !== 'undefined') {
22
28
  try {
23
29
  const { cache } = client
24
- const persistor = new CachePersistor({
30
+ persistor = new CachePersistor({
25
31
  cache,
26
32
  storage: new LocalStorageWrapper(window.localStorage),
27
33
  maxSize: false,
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.0.4",
5
+ "version": "3.0.7",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",
@@ -13,24 +13,24 @@
13
13
  }
14
14
  },
15
15
  "devDependencies": {
16
- "@graphcommerce/eslint-config-pwa": "^4.0.5",
17
- "@graphcommerce/prettier-config-pwa": "^4.0.3",
16
+ "@graphcommerce/eslint-config-pwa": "^4.1.4",
17
+ "@graphcommerce/prettier-config-pwa": "^4.0.5",
18
18
  "@graphcommerce/typescript-config-pwa": "^4.0.2",
19
- "@playwright/test": "^1.19.2"
19
+ "@playwright/test": "^1.20.1"
20
20
  },
21
21
  "dependencies": {
22
22
  "@apollo/client": "^3.5.10",
23
- "@graphcommerce/graphql-codegen-near-operation-file": "^3.0.5",
24
- "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "^3.0.5",
25
- "@graphql-codegen/add": "^3.1.1",
23
+ "@graphcommerce/graphql-codegen-near-operation-file": "3.0.9",
24
+ "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.6",
25
+ "@graphql-codegen/add": "3.1.1",
26
26
  "@graphql-codegen/fragment-matcher": "3.2.1",
27
27
  "@graphql-codegen/introspection": "2.1.1",
28
- "@graphql-codegen/schema-ast": "^2.4.1",
29
- "@graphql-codegen/typed-document-node": "^2.2.7",
30
- "@graphql-codegen/typescript": "^2.4.7",
31
- "@graphql-codegen/typescript-apollo-client-helpers": "^2.1.14",
32
- "@graphql-codegen/typescript-document-nodes": "2.2.7",
33
- "@graphql-codegen/typescript-operations": "2.3.4",
28
+ "@graphql-codegen/schema-ast": "2.4.1",
29
+ "@graphql-codegen/typed-document-node": "2.2.8",
30
+ "@graphql-codegen/typescript": "2.4.8",
31
+ "@graphql-codegen/typescript-apollo-client-helpers": "2.1.15",
32
+ "@graphql-codegen/typescript-document-nodes": "2.2.8",
33
+ "@graphql-codegen/typescript-operations": "2.3.5",
34
34
  "apollo3-cache-persist": "^0.14.0",
35
35
  "graphql": "^16.3.0"
36
36
  }
@@ -18,9 +18,15 @@ export async function waitForGraphQlResponse<Q, V>(
18
18
  docOrName: string | TypedDocumentNode<Q, V>,
19
19
  ): Promise<FetchResult<Q>> {
20
20
  const name = typeof docOrName === 'string' ? docOrName : getOperationName(docOrName)
21
- const response = await page.waitForResponse(
22
- (r) => r.request().postDataJSON()?.operationName === name,
23
- )
21
+
22
+ const response = await page.waitForResponse((r) => {
23
+ try {
24
+ return r.request().postDataJSON()?.operationName === name
25
+ } catch (e) {
26
+ return false
27
+ }
28
+ })
29
+
24
30
  return (await response?.json()) as FetchResult<Q>
25
31
  }
26
32