diff --git a/src/cache/core/types/common.ts b/src/cache/core/types/common.ts index fdad9b47547..5c7ac7db401 100644 --- a/src/cache/core/types/common.ts +++ b/src/cache/core/types/common.ts @@ -23,7 +23,6 @@ export class MissingFieldError extends Error { public readonly message: string, public readonly path: (string | number)[], public readonly query: import('graphql').DocumentNode, - public readonly clientOnly: boolean, public readonly variables?: Record, ) { super(message); diff --git a/src/cache/inmemory/__tests__/entityStore.ts b/src/cache/inmemory/__tests__/entityStore.ts index 5f300956dfc..396b683aede 100644 --- a/src/cache/inmemory/__tests__/entityStore.ts +++ b/src/cache/inmemory/__tests__/entityStore.ts @@ -1213,14 +1213,12 @@ describe('EntityStore', () => { 'Can\'t find field \'hobby\' on Author:{"name":"Ted Chiang"} object', ["authorOfBook", "hobby"], expect.anything(), // query - false, // clientOnly expect.anything(), // variables ), new MissingFieldError( 'Can\'t find field \'publisherOfBook\' on ROOT_QUERY object', ["publisherOfBook"], expect.anything(), // query - false, // clientOnly expect.anything(), // variables ), ], @@ -1814,7 +1812,6 @@ describe('EntityStore', () => { "Dangling reference to missing Author:2 object", ["book", "author"], expect.anything(), // query - false, // clientOnly expect.anything(), // variables ), ]; @@ -2084,7 +2081,6 @@ describe('EntityStore', () => { 'Can\'t find field \'title\' on Book:{"isbn":"031648637X"} object', ["book", "title"], expect.anything(), // query - false, // clientOnly expect.anything(), // variables ), ], diff --git a/src/cache/inmemory/__tests__/policies.ts b/src/cache/inmemory/__tests__/policies.ts index 0c7267553a2..0721b76f896 100644 --- a/src/cache/inmemory/__tests__/policies.ts +++ b/src/cache/inmemory/__tests__/policies.ts @@ -1352,7 +1352,6 @@ describe("type policies", function () { `Can't find field 'result' on Job:{"name":"Job #${jobNumber}"} object`, ["jobs", jobNumber - 1, "result"], expect.anything(), // query - false, // clientOnly expect.anything(), // variables ); } diff --git a/src/cache/inmemory/__tests__/readFromStore.ts b/src/cache/inmemory/__tests__/readFromStore.ts index 54d9e691741..c3c1deff2a6 100644 --- a/src/cache/inmemory/__tests__/readFromStore.ts +++ b/src/cache/inmemory/__tests__/readFromStore.ts @@ -729,7 +729,6 @@ describe('reading from the store', () => { }`, ["normal", "missing"], query, - false, // clientOnly {}, // variables ), new MissingFieldError( @@ -738,7 +737,6 @@ describe('reading from the store', () => { }`, ["clientOnly", "missing"], query, - true, // clientOnly {}, // variables ), ]); diff --git a/src/cache/inmemory/readFromStore.ts b/src/cache/inmemory/readFromStore.ts index 803855c7526..36caf7ea1d4 100644 --- a/src/cache/inmemory/readFromStore.ts +++ b/src/cache/inmemory/readFromStore.ts @@ -46,7 +46,6 @@ interface ReadContext extends ReadMergeModifyContext { canonizeResults: boolean; fragmentMap: FragmentMap; path: (string | number)[]; - clientOnly: boolean; }; export type ExecResult = { @@ -62,7 +61,6 @@ function missingFromInvariant( err.message, context.path.slice(), context.query, - context.clientOnly, context.variables, ); } @@ -241,7 +239,6 @@ export class StoreReader { canonizeResults, fragmentMap: createFragmentMap(getFragmentDefinitions(query)), path: [], - clientOnly: false, }, }); @@ -344,20 +341,6 @@ export class StoreReader { const resultName = resultKeyNameFromField(selection); context.path.push(resultName); - // If this field has an @client directive, then the field and - // everything beneath it is client-only, meaning it will never be - // sent to the server. - const wasClientOnly = context.clientOnly; - // Once we enter a client-only subtree of the query, we can avoid - // repeatedly checking selection.directives. - context.clientOnly = wasClientOnly || !!( - // We don't use the hasDirectives helper here, because it looks - // for directives anywhere inside the AST node, whereas we only - // care about directives directly attached to this field. - selection.directives && - selection.directives.some(d => d.name.value === "client") - ); - if (fieldValue === void 0) { if (!addTypenameToDocument.added(selection)) { getMissing().push( @@ -407,8 +390,6 @@ export class StoreReader { objectsToMerge.push({ [resultName]: fieldValue }); } - context.clientOnly = wasClientOnly; - invariant(context.path.pop() === resultName); } else {