You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Chat component breaks when embedded in a React app due to a Null Pointer Exception being thrown in the saveShellRef callback.
This happens when a re-render at the parent level is triggered, causing the Chat component to be unmounted, destroyed and a new instance mounted. When this occurs, null is passed to the old saveShellRef callback as argument and the NPE is thrown, causing the new component to stop functioning.
As per this React issue [0], ref callbacks need to handle null arguments. During a re-render, the ref callback from the old component will be passed null and the ref callback from the new component instance will be passed the new ref instance.
[0] facebook/react#4533
The text was updated successfully, but these errors were encountered:
@marrobins Could you submit your PR to this repos? It would be great if you could also look at other ref calls.
React call ref with null when it is unmounting the instance, so we are practically hitting this everywhere with .getWrappedInstance().
React will call the ref callback with the DOM element when the component mounts, and call it with null when it unmounts. ref callbacks are invoked before componentDidMount or componentDidUpdate lifecycle hooks.
The Chat component breaks when embedded in a React app due to a Null Pointer Exception being thrown in the saveShellRef callback.
This happens when a re-render at the parent level is triggered, causing the Chat component to be unmounted, destroyed and a new instance mounted. When this occurs,
null
is passed to the old saveShellRef callback as argument and the NPE is thrown, causing the new component to stop functioning.As per this React issue [0], ref callbacks need to handle null arguments. During a re-render, the ref callback from the old component will be passed
null
and the ref callback from the new component instance will be passed the new ref instance.[0] facebook/react#4533
The text was updated successfully, but these errors were encountered: