Skip to content

Commit

Permalink
Block editor: hooks: fix rules of hooks violations (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Mar 8, 2023
1 parent c3e7db8 commit a649844
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/block-editor/src/hooks/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ export const withInspectorControls = createHigherOrderComponent(
blockName,
POSITION_SUPPORT_KEY
);
const showPositionControls =
positionSupport && ! useIsPositionDisabled( props );
const isPositionDisabled = useIsPositionDisabled( props );
const showPositionControls = positionSupport && ! isPositionDisabled;

return [
showPositionControls && (
Expand All @@ -349,8 +349,9 @@ export const withPositionStyles = createHigherOrderComponent(
name,
POSITION_SUPPORT_KEY
);
const isPositionDisabled = useIsPositionDisabled( props );
const allowPositionStyles =
hasPositionBlockSupport && ! useIsPositionDisabled( props );
hasPositionBlockSupport && ! isPositionDisabled;

const id = useInstanceId( BlockListBlock );
const element = useContext( BlockList.__unstableElementContext );
Expand Down

0 comments on commit a649844

Please sign in to comment.