From a0ae203839731abb0f342a13d14dedf570ab686c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 2 Jul 2020 13:13:03 +0100 Subject: [PATCH] Fix composite bug --- .../block-editor/src/components/block-types-list/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-editor/src/components/block-types-list/index.js b/packages/block-editor/src/components/block-types-list/index.js index a7b4eac69f29cf..ade00533773606 100644 --- a/packages/block-editor/src/components/block-types-list/index.js +++ b/packages/block-editor/src/components/block-types-list/index.js @@ -23,6 +23,10 @@ function BlockTypesList( { } ) { const composite = useCompositeState(); const normalizedItems = includeVariationsInInserterItems( items ); + const orderId = normalizedItems.reduce( + ( acc, item ) => acc + '--' + item.id, + '' + ); return ( /* @@ -36,6 +40,8 @@ function BlockTypesList( { { ...composite } className="block-editor-block-types-list" aria-label={ label } + // This ensures the composite state refreshes when the list order changes. + key={ orderId } > { normalizedItems.map( ( item ) => { return (