Filter out ShimModelClass instances when running discoverEmberDataModels#2569
Merged
SergeAstapov merged 2 commits intomiragejs:masterfrom Feb 21, 2024
Merged
Conversation
gilest
commented
Nov 29, 2023
| */ | ||
| export function isDsModel(m) { | ||
| return m && typeof m.eachRelationship === 'function'; | ||
| return m && typeof m.eachRelationship === 'function' && m.isModel === true; |
Contributor
Author
There was a problem hiding this comment.
Not sure if isModel will be true for all classes we want to check
gilest
commented
Nov 29, 2023
Comment on lines
+1
to
+10
| // Mimics the static apis of ShimModelClass from ember-data | ||
| export default class Shim { | ||
| fields; | ||
| attributes; | ||
| relationshipsByName; | ||
|
|
||
| eachAttribute() {} | ||
| eachRelationship() {} | ||
| eachTransformedAttribute() {} | ||
| } |
Contributor
Author
Contributor
Author
|
@SergeAstapov what are your thoughts on this fix? 🙂 |
gilest
added a commit
to gilest/ember-cli-mirage
that referenced
this pull request
Jan 28, 2024
discoverEmberDataModelsShimModelClass instances when running discoverEmberDataModels
Collaborator
|
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 |
Collaborator
|
Thank you @gilest! |
Contributor
Author
|
Please cut a release when you get a chance 🥺 |
|
@SergeAstapov This seems to fix the issue with model discoverability in out apps. |
Collaborator
|
sorry for delays, this is published as v3.0.3. Thank you @gilest! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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: