Skip to content

Commit

Permalink
Block editor: hooks: fix rules of hooks violations (2) (#48943)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Sep 15, 2023
1 parent 9f3c9f1 commit 8a43c85
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 @@ -334,8 +334,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 @@ -361,8 +361,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 8a43c85

Please sign in to comment.