Skip to content

Performance: save components are called for *every* block on *every* keystroke #10427

@ellatrix

Description

@ellatrix

Describe the bug

This happens after the initial autosave, from then on every keystroke (or any attribute change) will trigger serialisation of the whole post content. I would expect (partial) serialisation of the content to only happen once the post has to be saved, ideally only for the parts that have changed.

The issue seems to happen where we try to determine whether the post is auto saveable?

export function isEditedPostAutosaveable( state ) {
// A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
if ( ! isEditedPostSaveable( state ) ) {
return false;
}
// If we don't already have an autosave, the post is autosaveable.
if ( ! hasAutosave( state ) ) {
return true;
}
// If the title, excerpt or content has changed, the post is autosaveable.
const autosave = getAutosave( state );
return [ 'title', 'excerpt', 'content' ].some( ( field ) => (
autosave[ field ] !== getEditedPostAttribute( state, field )
) );
}

Looking further into this, but reporting now because it seems high priority.

Metadata

Metadata

Assignees

Labels

[Priority] HighUsed to indicate top priority items that need quick attention[Type] PerformanceRelated to performance efforts

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions