react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

Bug: Maximum update depth exceeded

Open kukchanka opened this issue 5 years ago • 3 comments

I believe there is an issue with getPosition fucntion which is used to update tooltip position when it's outside the client widnow.

There are situations with floating tooltip (e.g. when we move cursor to the bottom of the page) when it cannot be displayed, so it tries to calculate a new desiredPlace and rerenders the component, but after rerendering getPosition finds out, that a previously calculated desiredPlace doesn't allow to render tooltip inside the client window, so it calculates a new one, which turns out to be the one we started with. It starts switching back and forth and "maximum update depth exceeded" error occurs.

To demostrate this, I added a pair console.logs inside getPosition and moved the cursor over tooltiped element: image This is what I got in my console just right before "Maximum update depth exceeded" error: image

kukchanka avatar Jan 04 '20 12:01 kukchanka

Created a pull-request fixing this issue: https://github.com/wwayne/react-tooltip/pull/528

kukchanka avatar Jan 04 '20 13:01 kukchanka

Issue still exists, it was returned after fix in https://github.com/wwayne/react-tooltip/issues/574

And in my case I see the problem, when based on position we add some extra styling to tooltip, i.e. left or top borders. So it goes into loop when trying to "updatePosition".

Zemelia avatar Aug 18 '22 07:08 Zemelia

UpdatePosition() shows Error : Maximum update depth exceeded.

pankajgandhi1010 avatar Aug 22 '22 13:08 pankajgandhi1010