-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextInput
component not handling events during the initial life cycles
#9670
Comments
TextInput
component not handling events during the initial life cycleTextInput
component not handling events during the initial life cycles
Thanks for this report and the sandbox 🙏 However, tweaking the reproductible react-admin-sanbox by moving the const raInput = document.querySelector('input[id="username-ra"]'); // it works
useEffect(() => {
... Knowing that the React way to get an element is to use All things considered, for me this use case is unreliable to properly investigate and qualify this issue. |
@adguernier you're absolutely correct, but I am not sure how did you make it work with a And this is probably because of the Note That!And also regarding moving the Please have a look at the screen shots attached below.
So I believe the issue is not about the retrieval of the component but rather the logic being handled inside the Thanks for looking into this! And happy to help out! |
Thanks for your report and the reproduction, which allows us to dig further. After further inspection, it seems that the problem isn't linked to the I tested it as follows:
Initially, all 3 inputs have the first letter typed in ('a'), but after going one step further, the first 2 inputs have the correct value ('a-') but the third one only has '-'. This tends to show that react-admin resets the form a bit too late. React-admin's So I tend to think it's a react-hook-form regression. To properly test it, you should set default values in your standalone RHF input. Also, this makes me think that it doesn't make sense to use react-admin's |
@fzaninotto But this ( Will this be handled from react-admin's side to simplify the |
Some bit of context
We use
react-admin
version4.16.9
in apnpm
monorepo workspace. And we have the automatic renovate pull requests to update our repository packages.Our end to end tests were successful before updating to
react-hook-form
from7.44.3
to7.51.0
then it started to fail consistently. The failing test was related toreact-admin
's logging in page.Test is as follows (in this order):
username
andpassword
fields.Assume the credentials are:
username
:a-user
password
:what-a-password
What you were expecting:
It was expected to fill in the
username
andpassword
fields normally. But we noticed that the test was failing because the typed in username was-user
(notice the missinga
) but the password field was normalwhat-a-password
.What happened instead:
It was expected of course that the
username
andpassword
to havea-user
andwhat-a-password
respectively.Steps to reproduce:
You can check the reproduction code here react-admin-delayed-sync.
If you change
react-hook-form
to7.44.3
then you will see the sync works as expectedVersion
7.44.3
react-hook-form-version-7.44.3.mov
Version
7.50.1
react-hook-form-version-7.50.1.mov
Thus, we can notice that the issue is with the
TextInput
component not from the registered input component withreact-hook-form
.Related code:
You can check the sandbox that I have created for this react-admin-delayed-sync.
Environment
The text was updated successfully, but these errors were encountered: