-
Notifications
You must be signed in to change notification settings - Fork 440
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
Filter out ShimModelClass
instances when running discoverEmberDataModels
#2569
Filter out ShimModelClass
instances when running discoverEmberDataModels
#2569
Conversation
@@ -11,5 +11,5 @@ export const hasEmberData = | |||
@hide | |||
*/ | |||
export function isDsModel(m) { | |||
return m && typeof m.eachRelationship === 'function'; | |||
return m && typeof m.eachRelationship === 'function' && m.isModel === true; |
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.
Not sure if isModel
will be true
for all classes we want to check
// Mimics the static apis of ShimModelClass from ember-data | ||
export default class Shim { | ||
fields; | ||
attributes; | ||
relationshipsByName; | ||
|
||
eachAttribute() {} | ||
eachRelationship() {} | ||
eachTransformedAttribute() {} | ||
} |
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.
@SergeAstapov what are your thoughts on this fix? 🙂 |
discoverEmberDataModels
ShimModelClass
instances when running discoverEmberDataModels
FWIW, I ran into the same issue and applied the patch locally, and at least in my case, didn't run into issues (e.g. non-ED model brought by addons that happens to have a |
Thank you @gilest! |
Please cut a release when you get a chance 🥺 |
@SergeAstapov This seems to fix the issue with model discoverability in out apps. |
sorry for delays, this is published as v3.0.3. Thank you @gilest! |
Maybe a naive fix, but I was making a fork to try privately anyway 🤷🏻
Believe this will be a blocker to upgrading to v3 for any apps which have non-Model files in their
app/models/
tree. This can be caused by addons so it's not always possible to resolve within an app without significant effort.Fixes #2556
Ref: