Skip to content

Commit

Permalink
Block Editor: Fix wrapper props mutation in BlockListBlock (#61789)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
3 people committed May 20, 2024
1 parent f78fac7 commit 72bfad5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,14 @@ function BlockListBlock( {
}

const { 'data-align': dataAlign, ...restWrapperProps } = wrapperProps ?? {};

restWrapperProps.className = clsx(
restWrapperProps.className,
dataAlign && themeSupportsLayout && `align${ dataAlign }`,
! ( dataAlign && isSticky ) && className
);
const updatedWrapperProps = {
...restWrapperProps,
className: clsx(
restWrapperProps.className,
dataAlign && themeSupportsLayout && `align${ dataAlign }`,
! ( dataAlign && isSticky ) && className
),
};

// We set a new context with the adjusted and filtered wrapperProps (through
// `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have
Expand All @@ -234,7 +236,7 @@ function BlockListBlock( {
return (
<PrivateBlockContext.Provider
value={ {
wrapperProps: restWrapperProps,
wrapperProps: updatedWrapperProps,
isAligned,
...context,
} }
Expand Down

0 comments on commit 72bfad5

Please sign in to comment.