From 41b6e4b9a3e5e0a513d8f337717dcf1383b010ef Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Thu, 27 Jul 2023 16:56:48 +1000 Subject: [PATCH] Check if spacing tool is defined before displaying controls. (#53008) * Check if spacing tool is defined before displaying controls. * Don't show sides if spacing type false --- packages/block-editor/src/components/global-styles/hooks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js index 9347afe54298e1..abd7ebc61b7c77 100644 --- a/packages/block-editor/src/components/global-styles/hooks.js +++ b/packages/block-editor/src/components/global-styles/hooks.js @@ -326,7 +326,8 @@ export function useSettingsForBlockElement( const sides = Array.isArray( supports?.spacing?.[ key ] ) ? supports?.spacing?.[ key ] : supports?.spacing?.[ key ]?.sides; - if ( sides?.length ) { + // Check if spacing type is supported before adding sides. + if ( sides?.length && updatedSettings.spacing?.[ key ] ) { updatedSettings.spacing = { ...updatedSettings.spacing, [ key ]: {