What should DS.Model.reload do if there are unsaved changes to the model?


#1

I had a situation where the model had a value update (set) done on it accidentally (I didn’t realize it at that point), followed by a reload. Since set puts the change into _attributes the changed value from reload didn’t show up at all (it goes into _data which has lower priority than values in _attributes).

Of course the _attributes values are supposed to be pushed to backend using save or aborted using rollback.

But that got me thinking. Is it sensible to even allow reload to start when there are unsaved changes in the model? I am trying to think of valid cases where you have unsaved changes in the model, yet you want to update the underlying non-changed fields for some reason.

It took me quite a bit of time to figure out what was happening since I had assumed that reload would just refresh the model, when … well, it did that, but not all of the changes were actually visible as I had expected them to be.

Or is this a case of updating docs on reload to note about unsaved changes? (OTOH, would not have helped me in this case since I didn’t even suspect there was a set hidden somewhere.)