diff --git a/x-pack/plugins/lens/public/drag_drop/drag_drop.tsx b/x-pack/plugins/lens/public/drag_drop/drag_drop.tsx index 51021a3e50b3f..5f116d29648c9 100644 --- a/x-pack/plugins/lens/public/drag_drop/drag_drop.tsx +++ b/x-pack/plugins/lens/public/drag_drop/drag_drop.tsx @@ -485,14 +485,18 @@ const DropsInner = memo(function DropsInner(props: DropsInnerProps) { }, [order, registerDropTarget, dropTypes, keyboardMode]); useEffect(() => { + let isMounted = true; if (activeDropTarget && activeDropTarget.id !== value.id) { setIsInZone(false); } setTimeout(() => { - if (!activeDropTarget) { + if (!activeDropTarget && isMounted) { setIsInZone(false); } }, 1000); + return () => { + isMounted = false; + }; }, [activeDropTarget, setIsInZone, value.id]); const dragEnter = () => {