diff --git a/packages/block-editor/src/components/gradients/use-gradient.js b/packages/block-editor/src/components/gradients/use-gradient.js index 256d9eb077dcb9..c3ded05b22e8d5 100644 --- a/packages/block-editor/src/components/gradients/use-gradient.js +++ b/packages/block-editor/src/components/gradients/use-gradient.js @@ -70,7 +70,7 @@ export function __experimentalUseGradient( { const { gradient, customGradient } = useSelect( ( select ) => { const { getBlockAttributes } = select( 'core/block-editor' ); - const attributes = getBlockAttributes( clientId ); + const attributes = getBlockAttributes( clientId ) || {}; return { customGradient: attributes[ customGradientAttribute ], gradient: attributes[ gradientAttribute ], diff --git a/packages/block-editor/src/components/use-editor-feature/index.js b/packages/block-editor/src/components/use-editor-feature/index.js index 163ffd2cb9b293..098ed231d8c186 100644 --- a/packages/block-editor/src/components/use-editor-feature/index.js +++ b/packages/block-editor/src/components/use-editor-feature/index.js @@ -87,7 +87,7 @@ export default function useEditorFeature( featurePath ) { '__experimentalSelector', ] ); if ( isObject( selectors ) ) { - const blockAttributes = getBlockAttributes( clientId ); + const blockAttributes = getBlockAttributes( clientId ) || {}; for ( const contextSelector in selectors ) { const { attributes } = selectors[ contextSelector ]; if ( blockAttributesMatch( blockAttributes, attributes ) ) {