Infinite callback of an observe when this.store.find is called


#1

The issue I am running into is that when observing on an ObjectController, after calling model.saveI() an observe is getting triggered infinitely because this.store.find() is triggering an update of the property I am observing.

App.IndexController = Ember.ObjectController.extend({
  // this gets triggered by model.save()
  search: function() {    
    // this triggers the observes('name') inf
    this.store.find('member');
  }.observes('name'),
  actions: {
    save: function() {
      this.get('model').save();
    }
  }
});

Any ideas about how to avoid this? Thanks!

Here is a jsbin showing the issue with some debugging to showcase the issue:


#2

So the solution I’m thinking is either:

  1. calling this.set('model', null); before saving the model
  2. in the search function, return unless mode.isNew

here’s a jsbin with the 2nd solution: http://emberjs.jsbin.com/ditit/2/edit