Skip to content

Commit ccff0d8

Browse files
committed
feat: de-select component on second click
1 parent b0a10d2 commit ccff0d8

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

  • packages/core/components/DraggableComponent

packages/core/components/DraggableComponent/index.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,23 @@ export const DraggableComponent = ({
359359
e.stopPropagation();
360360
}
361361

362-
dispatch({
363-
type: "setUi",
364-
ui: {
365-
itemSelector: { index, zone: zoneCompound },
366-
},
367-
});
362+
if (isSelected) {
363+
dispatch({
364+
type: "setUi",
365+
ui: {
366+
itemSelector: null,
367+
},
368+
});
369+
} else {
370+
dispatch({
371+
type: "setUi",
372+
ui: {
373+
itemSelector: { index, zone: zoneCompound },
374+
},
375+
});
376+
}
368377
},
369-
[index, zoneCompound, id]
378+
[index, zoneCompound, id, isSelected]
370379
);
371380

372381
const appStore = useAppStoreApi();

0 commit comments

Comments
 (0)