From 6ca77f4a506accadb8e6f1822c562fef176be124 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 28 Feb 2020 15:45:47 -0500 Subject: [PATCH] Editor: Clarify comment regarding meta attribute shim --- .../hooks/custom-sources-backwards-compatibility.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/hooks/custom-sources-backwards-compatibility.js b/packages/editor/src/hooks/custom-sources-backwards-compatibility.js index 586c91c9a379d..51d5bf4ac5fda 100644 --- a/packages/editor/src/hooks/custom-sources-backwards-compatibility.js +++ b/packages/editor/src/hooks/custom-sources-backwards-compatibility.js @@ -118,8 +118,8 @@ addFilter( ); // The above filter will only capture blocks registered after the filter was -// applied. There may already be registered by this point, and those must be -// updated to apply the shim. +// added. There may already be blocks registered by this point, and those must +// be updated to apply the shim. // // The following implementation achieves this, albeit with a couple caveats: // - Only blocks registered on the global store will be modified. @@ -128,6 +128,13 @@ addFilter( // `getBlockType` separate from `getBlockTypes`, since the latter returns a // _copy_ of the block registration (i.e. the mutation would not affect the // actual registered block settings). +// +// `getBlockTypes` or `getBlockType` implementation could change in the future +// in regards to creating settings clones, but the corresponding end-to-end +// tests for meta blocks should cover against any potential regressions. +// +// In the future, we could support updating block settings, at which point this +// implementation could use that mechanism instead. globalSelect( 'core/blocks' ) .getBlockTypes() .map( ( { name } ) => globalSelect( 'core/blocks' ).getBlockType( name ) )