Skip to content

Commit

Permalink
Update complex-object-link.js to handle 'null' values (#67)
Browse files Browse the repository at this point in the history
* Update complex-object-link.js

If val is null (and it could be for a mutation where you want to specifically set a field to null) this crashes as the type of null is "object" (sigh)

* Update CHANGELOG.md

Fixes #69
  • Loading branch information
alexeygolev authored and manueliglesias committed Mar 13, 2018
1 parent 5fa3dad commit 5c5deef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/aws-appsync/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### vNext
- Update complex-object-link.js to handle 'null' values [PR#67](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/67)

### 1.0.12
- Inconsistent store [PR#43](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/43)
- Delete observer associated with a topic when cleanup function is called [PR#60](https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/60)
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-appsync/src/link/complex-object-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const findInObject = obj => {
return Object.keys(obj).find(key => {
const val = obj[key];

if (typeof val === 'object') {
if (val && typeof val === 'object') {
const hasFields = complexObjectFields.every(field => {
const hasValue = val[field.name];
const types = Array.isArray(field.type) ? field.type : [field.type];
Expand Down

0 comments on commit 5c5deef

Please sign in to comment.