Skip to content

Commit

Permalink
fix(getPosition): updated getPosition to fix 'maximum update depth'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Kukchanka committed Jan 4, 2020
1 parent c28d02b commit 8fda305
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/getPosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down

0 comments on commit 8fda305

Please sign in to comment.