This merge request is intended to fix an insidious bug caused by a loss of reference to the input DOM element under certain circumstances.
In concreto, when the input loses focus, i.e. on blur, in response to an action which causes a re-render of the component, the input (momentarily) loses its reference: the re-render causes the ref function invoked by React.createElement to re-initialise, passing a null object on first render. At the moment, this causes both the inputRef and the forwardedRef to be set to null.
In between the first render and the second invocation of the React.createElement ref function, onBlur (and the useValue function) is called on a null inputRef, causing a crash.
A simple fix is checking for the existence of the reference returned by the ref callback.
This merge request is intended to fix an insidious bug caused by a loss of reference to the input DOM element under certain circumstances. In concreto, when the input loses focus, i.e. on blur, in response to an action which causes a re-render of the component, the input (momentarily) loses its reference: the re-render causes the ref function invoked by React.createElement to re-initialise, passing a null object on first render. At the moment, this causes both the inputRef and the forwardedRef to be set to null.
In between the first render and the second invocation of the React.createElement ref function, onBlur (and the useValue function) is called on a null inputRef, causing a crash.
A simple fix is checking for the existence of the reference returned by the ref callback.