61 строка
3.4 KiB
Diff
61 строка
3.4 KiB
Diff
diff --git a/node_modules/@apollo/client/cache/cache.cjs b/node_modules/@apollo/client/cache/cache.cjs
|
|
index afbbcd0..d93d0af 100644
|
|
--- a/node_modules/@apollo/client/cache/cache.cjs
|
|
+++ b/node_modules/@apollo/client/cache/cache.cjs
|
|
@@ -1479,7 +1479,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) {
|
|
@@ -1526,6 +1526,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
return {
|
|
args: argsFromFieldSpecifier(fieldSpec),
|
|
field: fieldSpec.field || null,
|
|
+ query: context.query,
|
|
fieldName: fieldName,
|
|
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 6a93238..fdef0a4 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 @@
|
|
-import { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from 'graphql';
|
|
+import { DocumentNode, InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from 'graphql';
|
|
import { FragmentMap, StoreValue, StoreObject, Reference, isReference } from '../../utilities';
|
|
import { IdGetter, MergeInfo, ReadMergeModifyContext } from "./types";
|
|
import { InMemoryCache } from './inMemoryCache';
|
|
@@ -44,6 +44,7 @@ export interface FieldFunctionOptions<TArgs = Record<string, any>, TVars = Recor
|
|
fieldName: string;
|
|
storeFieldName: string;
|
|
field: FieldNode | null;
|
|
+ query: DocumentNode;
|
|
variables?: TVars;
|
|
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 a2c1b93..d28dddf 100644
|
|
--- a/node_modules/@apollo/client/cache/inmemory/policies.js
|
|
+++ b/node_modules/@apollo/client/cache/inmemory/policies.js
|
|
@@ -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,
|
|
+ query: context.query,
|
|
fieldName: fieldName,
|
|
storeFieldName: storeFieldName,
|
|
variables: variables,
|