From 20f615ab8410c13c55b5b23983cc40d4540b8fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 23 Dec 2021 17:19:33 +0100 Subject: [PATCH] [patches] Update for @apollo/client 3.5.6 --- examples/apollo-watch-fragments/package.json | 2 +- ....4.13.patch => @apollo+client+3.5.6.patch} | 29 ++++++++++++------- yarn.lock | 20 +------------ 3 files changed, 21 insertions(+), 30 deletions(-) rename patches/{@apollo+client+3.4.13.patch => @apollo+client+3.5.6.patch} (66%) diff --git a/examples/apollo-watch-fragments/package.json b/examples/apollo-watch-fragments/package.json index a3fc2d9d..e32d8239 100644 --- a/examples/apollo-watch-fragments/package.json +++ b/examples/apollo-watch-fragments/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@apollo/client": "^3.4.13", + "@apollo/client": "^3.5.6", "@graphitation/apollo-react-relay-duct-tape": "^0.7.0", "@graphitation/graphql-js-tag": "^0.5.3", "@graphql-tools/schema": "^8.2.0", diff --git a/patches/@apollo+client+3.4.13.patch b/patches/@apollo+client+3.5.6.patch similarity index 66% rename from patches/@apollo+client+3.4.13.patch rename to patches/@apollo+client+3.5.6.patch index a6df86ce..78b06b2e 100644 --- a/patches/@apollo+client+3.4.13.patch +++ b/patches/@apollo+client+3.5.6.patch @@ -1,8 +1,8 @@ -diff --git a/node_modules/@apollo/client/cache/cache.cjs.js b/node_modules/@apollo/client/cache/cache.cjs.js -index c9ad278..e7501fd 100644 ---- a/node_modules/@apollo/client/cache/cache.cjs.js -+++ b/node_modules/@apollo/client/cache/cache.cjs.js -@@ -1627,7 +1627,7 @@ var Policies = (function () { +diff --git a/node_modules/@apollo/client/cache/cache.cjs b/node_modules/@apollo/client/cache/cache.cjs +index 97caee8..9a41cc5 100644 +--- a/node_modules/@apollo/client/cache/cache.cjs ++++ b/node_modules/@apollo/client/cache/cache.cjs +@@ -1475,7 +1475,7 @@ var Policies = (function () { } var storeFieldName = this.getStoreFieldName(options); var fieldName = fieldNameFromStoreName(storeFieldName); @@ -11,7 +11,7 @@ index c9ad278..e7501fd 100644 var policy = this.getFieldPolicy(options.typename, fieldName, false); var read = policy && policy.read; if (read) { -@@ -1670,6 +1670,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex +@@ -1522,6 +1522,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex return { args: argsFromFieldSpecifier(fieldSpec), field: fieldSpec.field || null, @@ -20,7 +20,7 @@ index c9ad278..e7501fd 100644 storeFieldName: storeFieldName, variables: variables, diff --git a/node_modules/@apollo/client/cache/inmemory/policies.d.ts b/node_modules/@apollo/client/cache/inmemory/policies.d.ts -index 4ac7a5d..28a8da6 100644 +index 9cdbb95..3f783d0 100644 --- a/node_modules/@apollo/client/cache/inmemory/policies.d.ts +++ b/node_modules/@apollo/client/cache/inmemory/policies.d.ts @@ -1,4 +1,4 @@ @@ -29,7 +29,7 @@ index 4ac7a5d..28a8da6 100644 import { FragmentMap, StoreValue, StoreObject, Reference, isReference } from '../../utilities'; import { IdGetter, MergeInfo, ReadMergeModifyContext } from "./types"; import { InMemoryCache } from './inMemoryCache'; -@@ -42,6 +42,7 @@ export interface FieldFunctionOptions, TVars = Recor +@@ -44,6 +44,7 @@ export interface FieldFunctionOptions, TVars = Recor fieldName: string; storeFieldName: string; field: FieldNode | null; @@ -38,10 +38,19 @@ index 4ac7a5d..28a8da6 100644 isReference: typeof isReference; toReference: ToReferenceFunction; diff --git a/node_modules/@apollo/client/cache/inmemory/policies.js b/node_modules/@apollo/client/cache/inmemory/policies.js -index 04b892a..f73e6fd 100644 +index b9dcc0d..0b2a53b 100644 --- a/node_modules/@apollo/client/cache/inmemory/policies.js +++ b/node_modules/@apollo/client/cache/inmemory/policies.js -@@ -354,6 +354,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex +@@ -297,7 +297,7 @@ var Policies = (function () { + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); +- var existing = context.store.getFieldValue(objectOrReference, storeFieldName); ++ var existing = objectOrReference && objectOrReference[fieldName] !== undefined ? objectOrReference[fieldName] : context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { +@@ -345,6 +345,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex return { args: argsFromFieldSpecifier(fieldSpec), field: fieldSpec.field || null, diff --git a/yarn.lock b/yarn.lock index 94d4579b..bf0fd1a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,7 +18,7 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@apollo/client@^3.3.15": +"@apollo/client@^3.3.15", "@apollo/client@^3.5.6": version "3.5.6" resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.5.6.tgz#911929df073280689efd98e5603047b79e0c39a2" integrity sha512-XHoouuEJ4L37mtfftcHHO1caCRrKKAofAwqRoq28UQIPMJk+e7n3X9OtRRNXKk/9tmhNkwelSary+EilfPwI7A== @@ -55,24 +55,6 @@ tslib "^2.3.0" zen-observable-ts "^1.2.5" -"@apollo/client@^3.4.13": - version "3.4.13" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.4.13.tgz#81670c27b376e80e3845ecf6468e534d908fa5b5" - integrity sha512-/nH8z/0X6WJ+wtUREHTlKQGX4lo6u3XkF1hy+k4eCxLZzT5+VRw1rm92iIkj1H85vep/eE/KV3DdRq1x3t9NnQ== - dependencies: - "@graphql-typed-document-node/core" "^3.0.0" - "@wry/context" "^0.6.0" - "@wry/equality" "^0.5.0" - "@wry/trie" "^0.3.0" - graphql-tag "^2.12.3" - hoist-non-react-statics "^3.3.2" - optimism "^0.16.1" - prop-types "^15.7.2" - symbol-observable "^4.0.0" - ts-invariant "^0.9.0" - tslib "^2.3.0" - zen-observable-ts "~1.1.0" - "@apollo/client@^3.7.15": version "3.7.15" resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.7.15.tgz#59dbeb5d64479f8ce0af321d8c0bf6df1d873e2d"