Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(core) - fix maskTypenames clauses #621

Merged
merged 2 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/red-candles-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@urql/core': patch
---

Add a guard to "maskTypenames" so a null value isn't considered an object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for other changesets, let’s write them more in the mood of why sth has changed rather than what has changed :)

2 changes: 1 addition & 1 deletion packages/core/src/utils/maskTypename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const maskTypename = (data: any): any => {
});
} else if (Array.isArray(value)) {
acc[key] = value.map(maskTypename);
} else if (typeof value === 'object' && '__typename' in value) {
} else if (value && typeof value === 'object' && '__typename' in value) {
acc[key] = maskTypename(value);
} else {
acc[key] = value;
Expand Down