-
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
DatePicker triggers value-changed
when attached
#2691
Comments
Could be related: #1360 |
Confirmed that the issue is reproducible for both DatePicker and TimePicker, and I guess for DateTimePicker as well, but I didn't check that. The described behavior comes out of the fact that DatePicker's default value is different on the client-side and the server-side. It is an empty string on the client-side and What happens in the example in detail:
What causes the issue in DatePicker / TimePicker?As you can see in the following fragment of code, DatePicker skips setting the presentation value when Lines 1200 to 1203 in 3d8c047
...and because the DatePicker constructor passes Why does the issue not concern TextField?Although TextField has a similar logic in the constructor: Lines 1118 to 1121 in 3d8c047
...the difference is that its constructor always passes |
Did a quick test and can verify that initializing the Flow component's I remember a similar change for the Select Flow component, where we needed to make sure that the Flow components Apart from that I'm a bit confused why you would call push during As a side note, I think it's kind of problematic that we rely on the |
It's indeed only simple way to reproduce the issue. |
Cool, thanks for confirming. |
The issue has been fixed. Stay tuned for V22.0.10 which will be out soon. |
Description
In an application I am working on, I use
UI#push
to force an update of the client site state (in my case I want to show a loading indicator). Now I noticed, that the value of displayedDatePicker
is wrongly set tonull
.I found that this is caused by a
ValueChangeEvent
coming from the client.After some debugging, I found that a
value-changed
event is triggered during theready
of the webcomponent, because the value changed fromundefined
to""
.If the value on the server is still the same at this time, no
ValueChangeEvent
will be triggered but if the value on the server changed in the mean time, aValueChangeEvent
withfromClient=true
is triggered and the server side value is changed tonull
.This can even result in a difference between the client side value and the server side value.
The
value-changed
event on the client also happens forTextField
(and probably other fields as well) but the server sideValueChangeEvent
only seems to happen withDatePicker
.Expected outcome
There should be no
ValueChangeEvent
withfromClient=true
unless the user manually changed the value on the client side.Actual outcome
There is an initial
value-changed
event on the client, which might create aValueChangeEvent
on the server, if the server value changed in the mean time.Live Demo (optional)
Notification that shows, when the server receives a
ValueCHangeEvent
from client:It triggers immediately after opening the page, basically as soon as the
Datepicker
is attached.Pressing the
Show values
button shows the server side values:The date on the server is now
null
, while the client shows the expected value (the current date).Minimal reproducible example
Steps to reproduce
EmptyView
Push
in theApplication
EmptyView
Show values
button and it will show a notification with the current server side values.Environment
The text was updated successfully, but these errors were encountered: