From 155fb3114352be0bedd16e3a79fbd07b41ce4fe7 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 9 Jul 2024 01:32:46 +1000 Subject: [PATCH] Section Styles: Fix error when blocks are deregistered (#63252) Co-authored-by: aaronrobertshaw Co-authored-by: t-hamano Co-authored-by: ndiego Co-authored-by: MadtownLems --- .../global-styles/use-global-styles-output.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/global-styles/use-global-styles-output.js b/packages/block-editor/src/components/global-styles/use-global-styles-output.js index 6756398708161..dba86b1db7f54 100644 --- a/packages/block-editor/src/components/global-styles/use-global-styles-output.js +++ b/packages/block-editor/src/components/global-styles/use-global-styles-output.js @@ -671,7 +671,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => { } const variationSelector = blockSelectors[ blockName ] - .styleVariationSelectors?.[ variationName ]; + ?.styleVariationSelectors?.[ variationName ]; // Process the variation's inner element styles. // This comes before the inner block styles so the @@ -700,18 +700,18 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => { const variationBlockSelector = scopeSelector( variationSelector, blockSelectors[ variationBlockName ] - .selector + ?.selector ); const variationDuotoneSelector = scopeSelector( variationSelector, blockSelectors[ variationBlockName ] - .duotoneSelector + ?.duotoneSelector ); const variationFeatureSelectors = scopeFeatureSelectors( variationSelector, blockSelectors[ variationBlockName ] - .featureSelectors + ?.featureSelectors ); const variationBlockStyleNodes = @@ -728,10 +728,10 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => { featureSelectors: variationFeatureSelectors, fallbackGapValue: blockSelectors[ variationBlockName ] - .fallbackGapValue, + ?.fallbackGapValue, hasLayoutSupport: blockSelectors[ variationBlockName ] - .hasLayoutSupport, + ?.hasLayoutSupport, styles: variationBlockStyleNodes, } );