mohsinulhaq/react-popper-tooltip

`getTriggerRef` invoking with null

hednowley opened this issue · 1 comments

Describe the bug
getTriggerRef in v3.1.1 is called with null rather than the real DOM element.

To Reproduce

Click the trigger in this sandbox and see the nulls logged to the console:
https://codesandbox.io/s/react-popper-tooltip-example-forked-f7ixp?file=/src/Example.js

Here is a copy of the same sandbox working on v2 for comparison:
https://codesandbox.io/s/react-popper-tooltip-example-forked-nyce6?file=/src/Example.js

Expected behaviour
The function ref to be called with the real trigger element.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 93.0.4577.63

If you see the code, getTriggerRef is being directly passed to the Reference component of react-popper. The difference between v2 and v3 was that react-popper was upgraded from v1 to v2. You can raise this issue with them to understand why on v1, getTriggerRef was called only once, but on v2 it's called once with the correct value and then with null on every subsequent re-render.