@@ -573,7 +573,7 @@ export const GridRowColumnResizingControlsComponent = ({
573
573
return (
574
574
< CanvasOffsetWrapper >
575
575
{ gridsWithVisibleResizeControls . flatMap ( ( grid ) => {
576
- if ( isGridItemSelected ( grid ) ) {
576
+ if ( isGridItemSelected ) {
577
577
return null
578
578
}
579
579
return (
@@ -596,7 +596,7 @@ export const GridRowColumnResizingControlsComponent = ({
596
596
)
597
597
} ) }
598
598
{ gridsWithVisibleResizeControls . flatMap ( ( grid ) => {
599
- if ( isGridItemSelected ( grid ) ) {
599
+ if ( isGridItemSelected ) {
600
600
return null
601
601
}
602
602
return (
@@ -1172,6 +1172,8 @@ export const GridControlsComponent = ({ targets }: GridControlsProps) => {
1172
1172
} ) ,
1173
1173
)
1174
1174
1175
+ const isGridItemSelectedWithoutInteraction = isGridItemSelected && ! isGridItemInteractionActive
1176
+
1175
1177
if ( grids . length === 0 ) {
1176
1178
return null
1177
1179
}
@@ -1184,8 +1186,6 @@ export const GridControlsComponent = ({ targets }: GridControlsProps) => {
1184
1186
grid . identifier ,
1185
1187
)
1186
1188
const shouldHaveVisibleControls = gridsWithVisibleControls . some ( ( g ) => {
1187
- const isGridItemSelectedWithoutInteraction =
1188
- isGridItemSelected ( grid ) && ! isGridItemInteractionActive
1189
1189
if ( isGridItemSelectedWithoutInteraction ) {
1190
1190
return false
1191
1191
}
@@ -2150,11 +2150,8 @@ function useIsGridItemInteractionActive() {
2150
2150
2151
2151
function useIsGridItemSelected ( ) {
2152
2152
const selectedViewsRef = useRefEditorState ( ( store ) => store . editor . selectedViews )
2153
-
2154
- return React . useCallback (
2155
- ( grid : GridData ) => {
2156
- return selectedViewsRef . current . some ( ( path ) => EP . isDescendantOf ( path , grid . identifier . path ) )
2157
- } ,
2158
- [ selectedViewsRef ] ,
2153
+ const jsxMetadataRef = useRefEditorState ( ( store ) => store . editor . jsxMetadata )
2154
+ return selectedViewsRef . current . some ( ( selected ) =>
2155
+ MetadataUtils . isGridItem ( jsxMetadataRef . current , selected ) ,
2159
2156
)
2160
2157
}
0 commit comments