-
-
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
Async in prod and debug version does not perform the same #4428
Comments
Hi Charles, Is it just that it's confusing that it's an error in development but allowed in production? Maybe we should change it to always throw? |
No please don't do this! It's actually quite useful because sometimes the related record is loaded after. |
@cbou I would say if you explicitly mark a relationship as synchronous via Any reason you're not using asynchronous relationships here? |
I used The reason is that I have some models which are loaded and updated outside of EmberJS. I keep them sync using |
Relationships are only loaded if they are explicitly requested... Maybe there is some code in your application which triggers loading of relationships as a side effect. Can you provide some sample code / ember-twiddle demonstrating your use case? |
I request them in the templates when calling |
Hmm, I don't know of any easy solution to that at the moment 😔 References added in #3303 allow you to check the loading state of relationships without triggering a fetch, but they are currently not available in templates... |
For the moment it's fine as long as an error is not throw in production like @fivetanley suggested. It would be better if |
Closing this as a duplicate of #5226 |
Because of the use of
assert
in the debug version of EmberJS Data, when using relationship withasync: false
the records needs to be loaded before using the relationship.In the prod version, the
assert
is not present which is allow to the relationship even if the related record is not loaded yet. It will be updated as soon as the record is loaded.To me the
assert
should be changed into awarn
.https://github.com/emberjs/data/blob/master/addon/-private/system/relationships/state/belongs-to.js#L143
https://github.com/emberjs/data/blob/master/addon/-private/system/relationships/state/has-many.js#L207
The text was updated successfully, but these errors were encountered: