Skip to content

Commit

Permalink
Log missing field errors in QueryListener function.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Apr 3, 2020
1 parent 5ea1214 commit 14f2719
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ExecutionResult, DocumentNode } from 'graphql';
import { invariant, InvariantError } from 'ts-invariant';
import equal from '@wry/equality';

import { ApolloLink } from '../link/core/ApolloLink';
import { execute } from '../link/core/execute';
Expand Down Expand Up @@ -571,8 +572,12 @@ export class QueryManager<TStore> {

observer.next && observer.next(result);

} else {
// TODO Warn in this case, or call observer.error?
} else if (process.env.NODE_ENV !== 'production' &&
isNonEmptyArray(diff.missing) &&
!equal(diff.result, {})) {
invariant.warn(`Missing cache result fields: ${
diff.missing.map(m => m.path.join('.')).join(', ')
}`, diff.missing);
}
};
}
Expand Down

0 comments on commit 14f2719

Please sign in to comment.