Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/editor/src/components/revision-fields-diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ function stringifyValue( value ) {
return String( value );
}

/**
* Determines whether a meta value should be treated as empty.
*
* @param {string} str The stringified value.
* @return {boolean} Whether the value is effectively empty.
*/
function isEmptyMeta( str ) {
return ! str || str === '[]' || str === '{}';
}

/**
* Panel that shows meta field diffs between the current revision and
* the previous revision in the document sidebar during revision mode.
Expand Down Expand Up @@ -72,7 +82,7 @@ export default function RevisionFieldsDiffPanel() {
const revStr = stringifyValue( revisionMeta[ key ] );
const prevStr = stringifyValue( previousMeta[ key ] );

if ( ! revStr && ! prevStr ) {
if ( isEmptyMeta( revStr ) && isEmptyMeta( prevStr ) ) {
continue;
}

Expand Down
Loading