-
Notifications
You must be signed in to change notification settings - Fork 67
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
Server roundtrip on every key stroke in invalid fields #4986
Comments
@yuriy-fix Not yet in my small test application. However, I don't know if this will be a problem for our bigger applications. Is there any issue which explains the necessity for the round trips? As stated in the description, the validations are not even updated |
I checked and the web component does indeed request the server to revalidate with each keystroke when invalid. However, the validation has no effect as the new value is only sent to the server on blur. We discussed it internally and reached a consensus to remove this revalidation logic since it currently brings more inconsistency than improvement. The right way to achieve eager revalidation is to use |
Shouldn't the fix only affect Flow, not the web component behavior? I mean, it has been 100% intentional, that when a field is invalid, every change to the input causes a revalidation, to give immediate feedback to the user when the input is valid, without the need to press enter or blur the field. |
Yes, I can confirm this. That's handled by |
Let me try again to get this straight. Please correct me if these two statements are incorrect:
I’m asking, if the fix should rather be to throttle the I would not want to change the web component behavior so that the user does not get immediate feedback when a field becomes valid when they are editing it. |
We have the same issue. If the content is invalid, we open a Dialog where the user can choose the correct value. Usually, this happens on blur, but if the field is invalid with every key stroke. This isn't very pleasant because this prevents me from migrating to Vaadin 24! |
If you try this project: https://github.com/jcgueriaud1/spring-proxy-issue/tree/field-issue Type ee in the name field then blur then type 12345 then the validator attached to the field is called like this:
This should probably be called like this:
|
One option to optimize would to fire validated only when necessary |
The validator is called multiple times, for example twice Validate name at the beginning instead of one. It's also called multiple times Validate ee with the wrong value (the value on the client side is ee1 then ee12,...) since the server is yet synchronized (the textfield is not eagerly synchronized). The validator should validate the correct value and to have the correct value on the server side it must run when the value is updated on the server side. |
But the fix will run the validation on the outdated value? |
This optimization doesn't seem correct because, while the field remains invalid, it can be caused by different reasons, requiring different error messages. Example:
|
Potentially yes, but in our current implementation the user indication is empty error message, and field shakes and goes invalid state |
I don't think this is "enhancement". This is a bug and a regression. |
We are currently refactoring the validation logic of triggering the validation from the client side. The aim is to reduce the number of roundtrips and validation invocations. |
Excellent! These are important things for both actual performance and marketing (evaluators are afraid of "chattiness" because of our architecture, and they do check what goes between client & server). BTW. Related Flow bugfix went in yesterday: vaadin/flow#17410 . I hope that helps your efforts. |
I have opened a discussion on the related topic: https://github.com/orgs/vaadin/discussions/4434#discussion-5571216 |
The issue will be resolved as part of #5537. |
Issue is resolved as a part of #5537. Fix should be available in |
Description
Typing in a invalid field triggers a server request on each key stroke, until next blur/enter. This even happens if the invalid attribute is manually set in the DOM in the browser.
Expected outcome
I would expect to have a server request on value change/blur, same behavior as if the field is not invalid.
Minimal reproducible example
Go to https://vaadin.com/docs/latest/components/number-field or https://vaadin.com/docs/latest/components/text-field with constraints
Steps to reproduce
In the number field:
Environment
Vaadin version(s): 24.0.3
OS: Windows
Browsers
Chrome, Firefox
The text was updated successfully, but these errors were encountered: