[Layout] Handle mutation edge case

Fix an edge case in the mutation capability where model
data could be lost during a mutation; this supports
auto-mutate/persist functionality for representations,
which allows Layout editing (transitioned for WTD-535)
to be persisted thereby.
This commit is contained in:
Victor Woeltjen 2014-12-06 09:28:46 -08:00
parent 6de973c11e
commit 5faf81e9a5

@ -59,7 +59,11 @@ define(
// Allow mutators to change their mind by
// returning false.
if (mutationResult !== false) {
copyValues(model, result);
// Copy values if result was a different object
// (either our clone or some other new thing)
if (model !== result) {
copyValues(model, result);
}
model.modified = Date.now();
}