Skip to content

Commit

Permalink
[Lens] Prevent React error on first field drop (#98269) (#98450)
Browse files Browse the repository at this point in the history
Co-authored-by: Marco Liberati <[email protected]>
  • Loading branch information
kibanamachine and dej611 authored Apr 27, 2021
1 parent 2234600 commit d3847c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion x-pack/plugins/lens/public/drag_drop/drag_drop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit d3847c1

Please sign in to comment.