InputText: lack of the input reference when the useLayoutEffect is being executed #7525
Labels
Resolution: Workaround
Issue or pull request contains a workaround. It needs to be reviewed further by Core Team
Describe the bug
Setting the
ref
to the element doesn't work correctly.If you create a new ref, assign it to the InputText component, and try to focus the input, then the error will be thrown because the element reference is not set yet.
Note: adding the
?
operator will fix the issue in the dev environment (React's StrictMode) but it won't for the production build. On the production build the useLayoutEffect will be called only once when the ref is not set yet.Reproducer
https://stackblitz.com/edit/cbt4me2u-y1z4u7vw?file=src%2FApp.jsx
System Information
Steps to reproduce the behavior
Expected behavior
The element's reference should be set already when executing the useLayoutEffect
The text was updated successfully, but these errors were encountered: