emberjs/website — pull request #1367 by izhan (2014-03-13 17:53:36+00:00)
Title: fixing getting-started bug when editing todo

Editing todos throws an error whenever the change is confirmed by using a newline (Enter). In particular, it throws the error

`Uncaught Error: Attempted to handle event 'willCommit' on while in state root.loaded.updated.inFlight. `

For the final Todo (Replacing the Fixture Adapter with Another Adapter), it throws the error

`Uncaught Error: Attempted to handle event 'willCommit' on while in state root.deleted.saved. `

when you attempt to delete a todo by editing the item to be blank. This error throws future errors in some cases such as `Assertion failed: calling set on destroyed object `, making the todo list unable to function. Note that this bug does not occur when one confirms an edit by clicking somewhere out of the textfield.

This bug occurs because when newline triggers an edit or removal of a todo, `acceptChanges` is called a second time due to the textfield being focused out. This may or may not be intended behavior -- PR fixes this and all JSBins by checking whether it is still in edit mode.