From 8fda3058b880eff6771a1ef1537013ae18996fe4 Mon Sep 17 00:00:00 2001 From: Andrei Kukchanka Date: Sat, 4 Jan 2020 16:25:44 +0300 Subject: [PATCH] fix(getPosition): updated getPosition to fix 'maximum update depth' --- src/utils/getPosition.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/getPosition.js b/src/utils/getPosition.js index 5f8d147c..218beffd 100644 --- a/src/utils/getPosition.js +++ b/src/utils/getPosition.js @@ -86,10 +86,11 @@ export default function (e, target, node, place, desiredPlace, effect, offset) { let isNewState = false let newPlace - if (inside(desiredPlace) && desiredPlace !== place) { + let shouldUpdatePlace = desiredPlace !== place + if (inside(desiredPlace) && shouldUpdatePlace) { isNewState = true newPlace = desiredPlace - } else if (insideList.length > 0 && outside(desiredPlace) && outside(place)) { + } else if (insideList.length > 0 && shouldUpdatePlace && outside(desiredPlace) && outside(place)) { isNewState = true newPlace = insideList[0] }