Skip to content

Commit

Permalink
Make 'Missing cache result fields...' warnings less noisy.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Jul 12, 2021
1 parent 4a8f1c3 commit 2d89e22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ export class QueryManager<TStore> {
isNonEmptyArray(diff.missing) &&
!equal(data, {}) &&
!returnPartialData) {
invariant.warn(`Missing cache result fields: ${
invariant.debug(`Missing cache result fields: ${
diff.missing.map(m => m.path.join('.')).join(', ')
}`, diff.missing);
}
Expand Down
11 changes: 3 additions & 8 deletions src/core/__tests__/QueryManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,6 @@ describe('QueryManager', () => {
});

itAsync('supports cache-only fetchPolicy fetching only cached data', (resolve, reject) => {
const spy = jest.spyOn(console, "warn").mockImplementation();
const primeQuery = gql`
query primeQuery {
luke: people_one(id: 1) {
Expand Down Expand Up @@ -1395,13 +1394,9 @@ describe('QueryManager', () => {
return handle.result().then(result => {
expect(result.data['luke'].name).toBe('Luke Skywalker');
expect(result.data).not.toHaveProperty('vader');
expect(spy).toHaveBeenCalledTimes(1);
});
})
.finally(() => {
spy.mockRestore();
})
.then(resolve, reject)
.then(resolve, reject);
});

itAsync('runs a mutation', (resolve, reject) => {
Expand Down Expand Up @@ -5785,8 +5780,8 @@ describe('QueryManager', () => {
let verbosity: ReturnType<typeof setVerbosity>;
let spy: any;
beforeEach(() => {
verbosity = setVerbosity("warn");
spy = jest.spyOn(console, "warn").mockImplementation();
verbosity = setVerbosity("debug");
spy = jest.spyOn(console, "debug").mockImplementation();
});

afterEach(() => {
Expand Down

0 comments on commit 2d89e22

Please sign in to comment.