From 9ab4b79e1287bcee7ae6dde4dff27612dce19faf Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 15 Jun 2026 12:55:25 +0300 Subject: [PATCH] Revisions: Ignore empty `[]/{}` meta values in the Meta diff panel --- .../src/components/revision-fields-diff/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/revision-fields-diff/index.js b/packages/editor/src/components/revision-fields-diff/index.js index 9d4f815c56f016..f9ee67280921a8 100644 --- a/packages/editor/src/components/revision-fields-diff/index.js +++ b/packages/editor/src/components/revision-fields-diff/index.js @@ -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. @@ -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; }