mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
Fixed post autosave for changes to nested objects in mobiledoc
no issue - fixes a problem that appeared after the first save of a post; refs for nested objects in the `mobiledoc` object didn't change so any time they were updated in the `scratch` object they were also updated in the `mobiledoc` object which broke our dirty attributes tracking - by creating a deep copy during save we ensure `scratch` and `mobiledoc` are kept separate without causing unnecessary copying (saves occur much less frequently than scratch updates)
This commit is contained in:
parent
77fa4439de
commit
7875a167ec
@ -297,8 +297,10 @@ export default Controller.extend({
|
||||
}
|
||||
|
||||
// Set the properties that are indirected
|
||||
// set mobiledoc equal to what's in the editor
|
||||
this.set('post.mobiledoc', this.get('post.scratch'));
|
||||
// set mobiledoc equal to what's in the editor but create a copy so that
|
||||
// nested objects/arrays don't keep references which can mean that both
|
||||
// scratch and mobiledoc get updated simultaneously
|
||||
this.set('post.mobiledoc', copy(this.get('post.scratch'), true));
|
||||
this.set('post.status', status);
|
||||
|
||||
// Set a default title
|
||||
|
Loading…
Reference in New Issue
Block a user