Matt Blair

Matt Blair

I read that you learn more from a poor example than from a correct one. I don't believe this but that means my site will be a success.

Ember - Test Teardown Error

Ember - Test Teardown Error

1-Minute Read

Cannot read property ‘addObject’ of null

If you see the following error in Ember.Data 1.0.0-beta.7:

Cannot read property 'addObject' of null
TypeError: Cannot read property 'addObject' of null
    at Ember.ArrayProxy.extend.addRecord
    at Ember.Object.extend.updateRecordArray
    at null.<anonymous>

I found this had to do with Test teardown. A monkey patch that solves the issue:

DS.RecordArray.reopen({
  addRecord: function(record) {
    var thing = Ember.get(this, 'content');

    if(thing) {
      this._super(record);
    }
  }
});

Recent Posts

Categories

About

This theme was developed for Hugo.