-
Notifications
You must be signed in to change notification settings - Fork 530
Cannot read property 'ownerDocument' of null #287
Comments
same here. |
I have this problem as well, can someone merge this please? |
I had this issue but was able to work around it. In my case I had code like this:
The problem is that the autocomplete will take the rendered items and apply a ref to them. It calls cloneElement with your rendered item as the element to clone and a ref as an additional property to apply. However, you cannot apply a ref to a functional component (see: https://reactjs.org/docs/refs-and-the-dom.html ). What ended up happening is my refs would be set to null and then later you'd get the error when trying to scroll the highlighted menu item into view (a useful feature). My solution was simple, though difficult to debug:
With this fix the rendered Item can properly a ref applied to it and the issue is avoided. In theory I could have also made MyFunctionalComponent into a non-functional component. It would be great to at least document this limitation if it can't be avoided. |
This is already documented in
Please open a new ticket with a detailed explanation if you're experiencing problems that aren't covered in the documentation. |
@CMTegner that should be called out a bit more clearly in the docs... totally glazed over that sentence. Are you open to a PR for a doc fix? |
I see that it already fixed in 1.4.2 but now 1.7.2 this error popup again!
The text was updated successfully, but these errors were encountered: