Ember Data Edit After Create "Error: Attempted to handle the` didCommit` event on <app @model: ...> while in root.loaded.updated.uncommitted state
tl; dr: edits model attributes when model retains officially unsupported? I seem to remember trying to edit while the record was inFlight, which was rejected by the state apparatus around 2013, but I thought the restriction was removed. It no longer throws a machine status error ... it just causes errors later: /
In the application I'm working on, pressing Enter creates a new entry and focuses the title field, allowing the user to immediately start typing. Changes in this field are automatically saved with saving disabled. This usually works fine, but if I start typing too fast, I get the following error:
Attempted to handle event `didCommit` on <app@model: ...> while in state root.loaded.updated.uncommitted.
(I included the full error and trace below [1])
The entry seems to be properly stored on the server ( Firebase via EmberFire ), but with this point there is another weirdness with the application (presumably because the iteration of the start loop explodes to completion).
To see what happened, I tied the observers to the fields of the model currentState.stateNameand title. To create and save without errors, the record goes through the following states:
[Press Enter; Pause]
|
V
root.loaded.created.uncommitted
|
V
<title observer fires with blank>
|
V
root.loaded.created.inFlight
|
V
root.loaded.saved
|
V
[Type in title]
|
V
root.loaded.updated.uncommitted
|
V
<title observer fires with value>
|
V
root.loaded.updated.inFlight
|
V
root.loaded.saved
:
[Press Enter & type immediately]
|
V
root.loaded.created.uncommitted
|
V
<title observer fires with blank>
|
V
root.loaded.created.inFlight
|
V
[title observer fires with value]
|
V
root.loaded.saved
|
V
root.loaded.updated.uncommitted
|
V
<Error appears>
|
V
root.loaded.updated.inFlight
|
V
root.loaded.saved
, , , root.loaded.updated.uncommitted - , root.loaded.updated.inFlight. , , , save() .
Edit: , . , , , .
(), , didCommit. , EmberFire didSaveRecord(), , EmberFire didSaveRecord(), .
Ember Data? , , . [2]
- ED , , , , ( , ).
, , - , ""... , Ember.
(, , ) ?
, "" ? , inFlight? ( isSaving, ?)
, ?
Edit:
, , Buffered Proxy ( : " " ), , . Luke Melia 2013 , "" ( ). Ember, "" , : ?
Edit:
- Ember CLI-, README - , (, -, , , , Ember)
[1] /:
ember.debug.js:31352 Error: Attempted to handle event `didCommit` on <app@model:task::ember965:-KLmwiGUhqrUW_CiRGb4> while in state root.loaded.updated.uncommitted.
at new Error (native)
at Error.EmberError (http://app.localtest.me:4200/assets/vendor.js:25781:21)
at InternalModel._unhandledEvent (http://app.localtest.me:4200/assets/vendor.js:82039:13)
at InternalModel.send (http://app.localtest.me:4200/assets/vendor.js:81917:14)
at InternalModel.adapterDidCommit (http://app.localtest.me:4200/assets/vendor.js:82220:12)
at didSaveRecord (http://app.localtest.me:4200/assets/vendor.js:89092:21)
at http://app.localtest.me:4200/assets/vendor.js:89814:15
at Object.Backburner.run (http://app.localtest.me:4200/assets/vendor.js:10788:25)
at _adapterRun (http://app.localtest.me:4200/assets/vendor.js:89648:31)
at http://app.localtest.me:4200/assets/vendor.js:89805:13
onerrorDefault @ ember.debug.js:31352
exports.default.trigger @ ember.debug.js:52095
(anonymous function) @ ember.debug.js:53346
Queue.invoke @ ember.debug.js:333
Queue.flush @ ember.debug.js:397
DeferredActionQueues.flush @ ember.debug.js:205
Backburner.end @ ember.debug.js:560
(anonymous function) @ ember.debug.js:1126
[2] two , :
- , . , , , (
isSaving). , , . DS.Transformserialize()- , , ,
Routemodel()hook, . - ,
inFlight. -, . -, Ember Persistence Foundation, , , 2014 (: )