You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling store.findRecord('foo', undefined) fails in a dev build with a very helpful error message:
Error: Assertion Failed: `id` passed to `findRecord()` has to be non-empty string or number
However doing the same thing in a production build does not fail and instead issues a request as if you had called store.findAll('foo'). It then resolves the promise with a model in a weird state where all fields are undefined:
This probably happens because the argument validation is implemented using Ember.asserthere and these assertions are stripped from production builds.
This behaviour can result in an extremely confusing and hard to understand situation where a model hook resolves but the model is in a completely broken state. It would be preferable in these cases for the model hook to just fail with the same or similar exception as we see in dev.
The text was updated successfully, but these errors were encountered:
I find the debug scenario helpful but in client code overall, if I am unsure of the type of identifier will be passed, I assumed this would be left up to the client to guard. What are your thoughts?
Calling
store.findRecord('foo', undefined)
fails in a dev build with a very helpful error message:However doing the same thing in a production build does not fail and instead issues a request as if you had called
store.findAll('foo')
. It then resolves the promise with a model in a weird state where all fields are undefined:This probably happens because the argument validation is implemented using
Ember.assert
here and these assertions are stripped from production builds.This behaviour can result in an extremely confusing and hard to understand situation where a model hook resolves but the model is in a completely broken state. It would be preferable in these cases for the model hook to just fail with the same or similar exception as we see in dev.
The text was updated successfully, but these errors were encountered: