Skip to content

Commit

Permalink
Fix strange "NS_ERROR_FAILURE" error
Browse files Browse the repository at this point in the history
  • Loading branch information
mreishus committed Aug 23, 2021
1 parent 0516de4 commit e00a1f5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const blockHasVisibilitySettings = name => {
'core/latest-comments',
'core/latest-posts',
'core/legacy-widget', // These already have legacy visibility settings, avoid 2 levels of controls
'core/widget-area',
] );
return ! disallowed.has( name );
};
Expand Down Expand Up @@ -195,7 +196,10 @@ const visibilityAdvancedControls = createHigherOrderComponent(

// Initialize props.conditions if none is sent.
useEffect( () => {
if ( ! ( 'action' in conditions ) || ! ( 'match_all' in conditions ) ) {
if (
blockHasVisibilitySettings( props.name ) &&
( ! ( 'action' in conditions ) || ! ( 'match_all' in conditions ) )
) {
setAttributes( {
conditions: {
action: 'show',
Expand All @@ -204,7 +208,7 @@ const visibilityAdvancedControls = createHigherOrderComponent(
},
} );
}
}, [ conditions, setAttributes ] );
}, [ conditions, setAttributes, props.name ] );

const toggleMatchAll = useCallback(
() =>
Expand Down

0 comments on commit e00a1f5

Please sign in to comment.