Skip to content

Commit

Permalink
Only skip normal attribute updates for pattern overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jun 12, 2024
1 parent 95999a9 commit f54d88c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/block-editor/src/hooks/use-bindings-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ export const withBlockBindingSupport = createHigherOrderComponent(
unlock( select( blocksStore ) ).getAllBlockBindingsSources()
);
const { name, clientId, context } = props;
const hasDefaultBinding =
props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ];
const hasPatternOverridesDefaultBinding =
props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]
?.source === 'core/pattern-overrides';
const bindings = useMemo(
() =>
replacePatternOverrideDefaultBindings(
Expand Down Expand Up @@ -215,8 +216,11 @@ export const withBlockBindingSupport = createHigherOrderComponent(
}
}

// Only apply normal attribute updates to blocks
// that have partial bindings. Currently this is
// only skipped for pattern overrides sources.
if (
! hasDefaultBinding &&
! hasPatternOverridesDefaultBinding &&
Object.keys( keptAttributes ).length
) {
setAttributes( keptAttributes );
Expand All @@ -231,7 +235,7 @@ export const withBlockBindingSupport = createHigherOrderComponent(
context,
setAttributes,
sources,
hasDefaultBinding,
hasPatternOverridesDefaultBinding,
]
);

Expand Down

0 comments on commit f54d88c

Please sign in to comment.