Skip to content

Commit

Permalink
#889: ensure we always keep the id if it is used as key
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed May 26, 2023
1 parent 8c304fb commit 3a43aea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,10 @@ class MetadataType {
// so its in retrieve but not in save. Here we put into the clone so that the original
// object used for caching doesnt have the Id removed.
const saveClone = JSON.parse(JSON.stringify(results[originalKey]));
if (!this.definition.keepId) {
if (
!this.definition.keepId &&
this.definition.idField !== this.definition.keyField
) {
delete saveClone[this.definition.idField];
}

Expand Down

0 comments on commit 3a43aea

Please sign in to comment.