Ember.Object with ownerInjection cannot be JSON.stringified
See original GitHub issueHi!
I ran into an issue (offirgolan/ember-cp-validations#507) while introducing ember-cp-validations
into a project where creating Ember.Object
s with an ownerInjection
results in TypeError: Converting circular structure to JSON
. I have provided an Ember Twiddle https://ember-twiddle.com/979d8fc762574b457e04393cd9852159?openFiles=controllers.index.js%2C that demonstrates this behavior.
As the default Ember Data ajaxOptions
function calls JSON.stringify
, I overrode this function in my app to ignore the __OWNER__
property.
I don’t know that addressing the circular reference makes sense in this context as the entire instance would then appear in the stringified representation so perhaps Ember Data is the correct repo to report this in? If that is the case, please let me know and I’ll close this in favor of an issue in the Ember Data repo. Thanks 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:11 (5 by maintainers)
I mean we just use the hackaround as I described above in our product, but it is still an issue… All you really need to reproduce it is:
Here’s a twiddle of the same: https://ember-twiddle.com/b11d1084021dd0ff1dcf19226f2d7d01
And the fix would be to have
setOwner()
define it as a non-enumerable property as I did above.Confirmed. I was able to delete my overridden
ajaxOptions
function. Thanks!