Skip to content

Commit 842ec48

Browse files
committed
update usage
1 parent c08ab15 commit 842ec48

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

editor/src/components/canvas/controls/grid-controls.tsx

+7-10
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ export const GridRowColumnResizingControlsComponent = ({
573573
return (
574574
<CanvasOffsetWrapper>
575575
{gridsWithVisibleResizeControls.flatMap((grid) => {
576-
if (isGridItemSelected(grid)) {
576+
if (isGridItemSelected) {
577577
return null
578578
}
579579
return (
@@ -596,7 +596,7 @@ export const GridRowColumnResizingControlsComponent = ({
596596
)
597597
})}
598598
{gridsWithVisibleResizeControls.flatMap((grid) => {
599-
if (isGridItemSelected(grid)) {
599+
if (isGridItemSelected) {
600600
return null
601601
}
602602
return (
@@ -1172,6 +1172,8 @@ export const GridControlsComponent = ({ targets }: GridControlsProps) => {
11721172
}),
11731173
)
11741174

1175+
const isGridItemSelectedWithoutInteraction = isGridItemSelected && !isGridItemInteractionActive
1176+
11751177
if (grids.length === 0) {
11761178
return null
11771179
}
@@ -1184,8 +1186,6 @@ export const GridControlsComponent = ({ targets }: GridControlsProps) => {
11841186
grid.identifier,
11851187
)
11861188
const shouldHaveVisibleControls = gridsWithVisibleControls.some((g) => {
1187-
const isGridItemSelectedWithoutInteraction =
1188-
isGridItemSelected(grid) && !isGridItemInteractionActive
11891189
if (isGridItemSelectedWithoutInteraction) {
11901190
return false
11911191
}
@@ -2150,11 +2150,8 @@ function useIsGridItemInteractionActive() {
21502150

21512151
function useIsGridItemSelected() {
21522152
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),
21592156
)
21602157
}

0 commit comments

Comments
 (0)