From bc0dccbf2d82da7ce0cf6e97b76954f0545fe03c Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Fri, 18 Mar 2022 10:06:11 +0300 Subject: [PATCH] chore: apply code review suggestions --- .../vaadin/flow/component/datetimepicker/DateTimePicker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePicker.java b/vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePicker.java index 6f57b6a82b6..b3441670173 100644 --- a/vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePicker.java +++ b/vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePicker.java @@ -144,7 +144,10 @@ public DateTimePicker(LocalDateTime initialDateTime) { setPresentationValue(initialDateTime); synchronizeChildComponentValues(initialDateTime); } else if (this.getElement().getProperty("value") == null) { - // Only apply initial value if the element does not already have a value, + // Applying `null` forces the client side `value` property to have an empty string. + // Having an empty string prevents `ValueChangeEvent` which otherwise can be triggered + // as a result of Polymer converting `null` to an empty string by itself. + // Only apply `null` if the element does not already have a value, // which can be the case when binding to an existing element from a Lit // template. setPresentationValue(null);