-
Notifications
You must be signed in to change notification settings - Fork 193
Open
Description
Description of the bug
If an element has a two-way signal binding for an property, then every invocation of Element.setProperty triggers running the write callback again even if the provided value is the same as the previous value. This is inconsistent with other element property features such as addPropertyChangeListener where assigning the same value again is completely ignored.
Expected behavior
Expected that the write callback is called only if the property value changes.
Minimal reproducible example
ValueSignal<String> signal = new ValueSignal<>("Value");
Element bindingElement = new Element("input");
bindingElement.bindProperty("value", signal, value -> {
System.out.println("Writback callback: " + value);
signal.set(value);
});
Element listenerElement = new Element("input");
listenerElement.addPropertyChangeListener("value", event -> {
System.out.println("Property change: " + event.getValue());
});
getElement().appendChild(bindingElement);
getElement().appendChild(listenerElement);
add(new Button("Reset field", click -> {
bindingElement.setProperty("value", "Reset");
listenerElement.setProperty("value", "Reset");
}));- Click the button, observe that each listener is run
- Click the button again, observe that the listener isn't run but the write callback is run
Versions
- Vaadin / Flow version: Vaadin 25.1.0-rc2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels