Skip to content

Commit

Permalink
[BUGFIX] fix detect usage for native class polymorphism
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Nov 19, 2019
1 parent c702a0a commit 294d399
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/store/addon/-debug/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ let assertPolymorphicType;
if (DEBUG) {
let checkPolymorphic = function checkPolymorphic(modelClass, addedModelClass) {
if (modelClass.__isMixin) {
//TODO Need to do this in order to support mixins, should convert to public api
//once it exists in Ember
return modelClass.__mixin.detect(addedModelClass.PrototypeMixin);
return (
modelClass.__mixin.detect(addedModelClass.PrototypeMixin) ||
// handle native class extension e.g. `class Post extends Model.extend(Commentable) {}`
modelClass.__mixin.detect(Object.getPrototypeOf(addedModelClass).PrototypeMixin)
);
}

return addedModelClass.prototype instanceof modelClass || modelClass.detect(addedModelClass);
Expand Down

0 comments on commit 294d399

Please sign in to comment.