website icon indicating copy to clipboard operation
website copied to clipboard

Error in Getting Started: accepting edits

Open pootsbook opened this issue 13 years ago • 5 comments

Getting the following error in both the JSBin and my local copy for the accepting edits step in the Getting Started Guide:

Uncaught Error: Attempted to handle event `willCommit` on <Todos.Todo:ember351:2> while in state rootState.loaded.updated.inFlight. Called with undefined

It doesn't seem to affect the functionality at all, is this simply an issue with saving in the FixtureAdapter @trek?

accepting_edits

pootsbook avatar May 31 '13 20:05 pootsbook

I have the same problem. Eventually »solved« it like this by adding a guard clause to the acceptChanges method on the Todos.TodoController:

acceptChanges: function () {
  var todo = this.get('model');
  if (todo.get('isSaving')) { return; }
  this.set('isEditing', false);
  todo.save();
},

The obvious question now is: how does one solve this completely? The problem is this: if the record is currently saving (in-flight state) but I've done edits while it's doing that then I can't schedule a save after the original one is done? There are about a million ways to take care of this but it still doesn't solve this elegantly.

Comments are very much appreciated.

On another note: shouldn't this issue live somewhere else? It doesn't really have anything to do with the website.

dreyinger avatar Jul 04 '13 10:07 dreyinger

Had same issue in tutorial and your guard clause "fixed" my situation too

Here's another thread on the same issue: https://github.com/emberjs/data/issues/1024

mikedorsey avatar Jul 23 '13 08:07 mikedorsey

I am having the same issue with my application. It's big and private so I can't really give a jsbin or jsfiddle link, but just to let you know that it's not only on the TODO. I'm saving a record with

record.save()
record.get('transaction').commit()

Maybe I'm doing something wrong if so please lemme know, else it confirms the issue.

DEBUG: ------------------------------- vendor/scripts/ember.js:365
DEBUG: Ember.VERSION : 1.0.0-rc.6 vendor/scripts/ember.js:365
DEBUG: Handlebars.VERSION : 1.0.0 vendor/scripts/ember.js:365
DEBUG: jQuery.VERSION : 1.9.1 vendor/scripts/ember.js:365
DEBUG: ------------------------------- 

huafu avatar Aug 03 '13 10:08 huafu

Well, sounds like using App.get('store').commit() instead of record.get('transaction').commit() fixed my issue...

huafu avatar Aug 03 '13 10:08 huafu

The latest guide, when published will be for Ember 1.0 and Data 1.0 alpha. Should resole this issue.

trek avatar Sep 01 '13 01:09 trek