Fix delete not deleting when searching for something

This commit is contained in:
Lucas Oliveira 2023-11-29 18:45:31 -03:00
commit 1fd2931e4c
2 changed files with 11 additions and 9 deletions

View file

@ -172,8 +172,9 @@ export function FlowsProvider({ children }: { children: ReactNode }) {
}
});
setData((prev) => {
prev["saved_components"] = cloneDeep(savedComponents);
return prev;
let newData = cloneDeep(prev);
newData["saved_components"] = cloneDeep(savedComponents);
return newData;
});
}

View file

@ -41,11 +41,13 @@ export default function SidebarDraggableComponent({
const popoverRef = useRef<HTMLDivElement>(null);
const handlePointerDown = (e) => {
const rect = popoverRef.current?.getBoundingClientRect() ?? {
left: 0,
top: 0,
};
setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
if (!open) {
const rect = popoverRef.current?.getBoundingClientRect() ?? {
left: 0,
top: 0,
};
setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
}
};
function handleSelectChange(value: string) {
@ -74,9 +76,8 @@ export default function SidebarDraggableComponent({
>
<div
onPointerDown={handlePointerDown}
onContextMenu={(e) => {
onContextMenuCapture={(e) => {
e.preventDefault();
console.log("que");
setOpen(true);
}}
key={itemName}