Skip to content

Commit

Permalink
Simplify ROOT_QUERY fragment matching logic slightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Apr 8, 2019
1 parent 1ebe5b4 commit 2f63064
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/apollo-cache-inmemory/src/fragmentMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ export class HeuristicFragmentMatcher implements FragmentMatcherInterface {
): boolean | 'heuristic' {
const obj = context.store.get(idValue.id);

if (!obj && idValue.id === 'ROOT_QUERY') {
return true;
}

if (!obj) {
return false;
// https://github.com/apollographql/apollo-client/pull/3507
return idValue.id === 'ROOT_QUERY';
}

if (!obj.__typename) {
Expand Down Expand Up @@ -124,12 +121,9 @@ export class IntrospectionFragmentMatcher implements FragmentMatcherInterface {

const obj = context.store.get(idValue.id);

if (!obj && idValue.id === 'ROOT_QUERY') {
return true;
}

if (!obj) {
return false;
// https://github.com/apollographql/apollo-client/pull/4620
return idValue.id === 'ROOT_QUERY';
}

invariant(
Expand Down

0 comments on commit 2f63064

Please sign in to comment.