Skip to content

Commit

Permalink
Fixes changesets for ember data models with more than one attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
luketheobscure committed Jan 14, 2020
1 parent 7407258 commit 6170b40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addon/utils/merge-deep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ function propertyIsOnObject(object: any, property: any) {

// Protects from prototype poisoning and unexpected merging up the prototype chain.
function propertyIsUnsafe(target: any, key: string): Boolean {
// Special case for ember data model attributes.
if(target.constructor && target.constructor.attributes && target.constructor.attributes.has(key)) {
return false;
}

return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
&& Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
Expand Down

0 comments on commit 6170b40

Please sign in to comment.