Skip to content

Commit

Permalink
Fix allow overrides check
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Apr 18, 2024
1 parent 8d8820a commit 1e7b666
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/patterns/src/components/pattern-overrides-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ function PatternOverridesControls( { attributes, setAttributes } ) {
const [ showDisallowOverridesModal, setShowDisallowOverridesModal ] =
useState( false );

const hasName = !! attributes.metadata?.name;
const defaultBindings = attributes.metadata?.bindings?.__default;
const allowOverrides =
defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;
hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;
const isConnectedToOtherSources =
defaultBindings?.source &&
defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE;
Expand All @@ -67,14 +68,6 @@ function PatternOverridesControls( { attributes, setAttributes } ) {

// Avoid overwriting other (e.g. meta) bindings.
if ( isConnectedToOtherSources ) return null;

const hasName = !! attributes.metadata?.name;
const allowOverrides =
hasName &&
attributeSources.some(
( source ) => source === PATTERN_OVERRIDES_BINDING_SOURCE
);

return (
<>
<InspectorControls group="advanced">
Expand Down

0 comments on commit 1e7b666

Please sign in to comment.