Skip to content

Commit

Permalink
Fix empty previousAttributes in collection models
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardograca committed Dec 9, 2018
1 parent ebe3c5c commit f0d7d63
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/collection.js
Expand Up @@ -440,8 +440,11 @@ const BookshelfCollection = (module.exports = CollectionBase.extend(
remove: options.remove,
silent: true,
parse: true
}).invokeMap('formatTimestamps');
this.invokeMap('_reset');
}).invokeMap(function() {
this.formatTimestamps();
this._reset();
this._previousAttributes = _.cloneDeep(this.attributes);
});

if (relatedData && relatedData.isJoined()) {
relatedData.parsePivot(this.models);
Expand Down

0 comments on commit f0d7d63

Please sign in to comment.