Trackit currently uses underscore's clone method to set original attributes, which is a shallow clone and not a deep clone. As a result, changing nested attributes in a model will also change the attributes in model._originalAttrs. When calling model.unsavedAttributes(), a comparison of the original attributes and current attributes will indicate that there are no unsaved attributes.
This implementation adds a _cloneAttributes method to perform a deep clone on the original attributes for a more accurate comparison when calling unsavedAttributes. Unfortunately, underscore doesn't have a deep clone method and has repeatedly refused implementing one.
Trackit currently uses underscore's clone method to set original attributes, which is a shallow clone and not a deep clone. As a result, changing nested attributes in a model will also change the attributes in
model._originalAttrs
. When callingmodel.unsavedAttributes()
, a comparison of the original attributes and current attributes will indicate that there are no unsaved attributes.This implementation adds a
_cloneAttributes
method to perform a deep clone on the original attributes for a more accurate comparison when callingunsavedAttributes
. Unfortunately, underscore doesn't have a deep clone method and has repeatedly refused implementing one.