Skip to content

Commit

Permalink
fix(@aws-amplify/datastore): remove null properties from connected mo…
Browse files Browse the repository at this point in the history
…del instances (#8623)

Github actions are having trouble installing dependencies through the Verdaccio server, but these changes have no effect on this - merging.
  • Loading branch information
nickarocho authored Jul 22, 2021
1 parent 8787a8d commit 569214c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/datastore/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,12 @@ export const traverseModel = <T extends PersistentModel>(
}
}

(<any>draftInstance)[rItem.targetName] = draftInstance[
rItem.fieldName
]
? (<PersistentModel>draftInstance[rItem.fieldName]).id
: null;

delete draftInstance[rItem.fieldName];
if (draftInstance[rItem.fieldName]) {
(<any>draftInstance)[rItem.targetName] = (<PersistentModel>(
draftInstance[rItem.fieldName]
)).id;
delete draftInstance[rItem.fieldName];
}

break;
case 'HAS_MANY':
Expand Down

0 comments on commit 569214c

Please sign in to comment.