So in the following scenario, what should I do?
- bring up the form, i.e. create a new record (isNew == true)
- user edits the form (isNew == false, dirtyType == ‘edited’)
- user hits discard (rollback()), and work on the form again…
- user hits discard again (rollback())
- finally he decides to hit the dimiss form button, (now my ember app just errors out since if i do .deleteRecord() on the new/dirty model, it will raise deleteRecord in saved.deleted state.
I understand perhaps this above scenario sounds like me picking on the framework. But this happened when I was demoing to my customer. Fundamentally, when you have a new record to start with, if you rollback the changes, you should revert back to the pristine, new state. Not a saved and deleted state. In addition, this saved deleted state makes even less sense when you consider a pristine state usually means it doesn’t valdiate yet, so how can you possibly be in a “saved” state, unless one thinks saved state can be reached when the record is invalid.
By the way, has anyone covered the state transition diagram in some posts?