-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: compact watchQueryOptions (#77)
Options with undefined values shouldn't be passed to Apollo Client, otherwise they'll override any default options set on the client. This compacting behavior to remove undefined values is copied from React Apollo.
- Loading branch information
1 parent
5d60caa
commit 39f59eb
Showing
3 changed files
with
34 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { compact } from '../utils'; | ||
|
||
describe('compact', () => { | ||
it('returns a new object omitting any keys with an undefined value', () => { | ||
const compacted = compact({ a: 'value', b: 1, c: undefined }); | ||
expect(compacted.hasOwnProperty('c')).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters