Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Don't subscribe dimensions panel to store if it's disabled
  • Loading branch information
jeryj committed Nov 5, 2025
commit a16d114014f70c0e037277772caa39db37883a08
12 changes: 9 additions & 3 deletions packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ function DimensionsInspectorControl( { children, resetAllFilter } ) {
export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
const isEnabled = useHasDimensionsPanel( settings );
const value = useSelect(
( select ) =>
select( blockEditorStore ).getBlockAttributes( clientId )?.style,
[ clientId ]
( select ) => {
// Early return to avoid subscription when disabled
if ( ! isEnabled ) {
return undefined;
}
return select( blockEditorStore ).getBlockAttributes( clientId )
?.style;
},
[ clientId, isEnabled ]
);
const [ visualizedProperty, setVisualizedProperty ] = useVisualizer();
const onChange = ( newStyle ) => {
Expand Down