-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHORE] inject the Model specific _modelForMixin implementation into the store from the Model package #6800
Conversation
…the store from the Model package
ba7e83f
to
3e4d5f0
Compare
} | ||
return _Model; | ||
} | ||
import { RecordInstance } from '../ts-interfaces/record-instance'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RecordInstance
is for the instantiated record instances, I believe based on usage below you are in need of ModelSchema
or DSModelSchema
let factory = cache[normalizedModelName]; | ||
|
||
if (!factory) { | ||
factory = _lookupModelFactory(store, normalizedModelName); | ||
|
||
if (!factory) { | ||
//Support looking up mixins as base types for polymorphic relationships | ||
factory = _modelForMixin(store, normalizedModelName); | ||
factory = store._modelForMixin(normalizedModelName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding a private method to store and injecting it from the model package, we should use the HAS_MODEL_PACKAGE
build flag to conditionally import a private function from that package.
let _modelForMixin;
if (HAS_MODEL_PACKAGE) {
_modelForMixin = require('@ember-data/model/-private')._modelForMixin;
}
// ....
if (HAS_MODEL_PACKAGE) {
factory = _modelForMixin(store, normalizedModelName);
}
possibly with a module scope cache for the method to avoid looking it up each time.
Closing in favor of #6802 |
For #6166