Skip to content

Property value is not properly reset for ignored two-way binding #23982

@Legioth

Description

@Legioth

Description of the bug

With a two-way binding to an element property, a no-op write callback is supposed to reset the property value back to the original value that is still the signal value. That's also what happens from the server's point of view but the change is never propagated to the client. This is probably because the communication logic doesn't know that the property value has changed and thus treats the value "reset" as a no-op.

Expected behavior

Expected that the property value is restored also in the browser.

Minimal reproducible example

ValueSignal<String> signal = new ValueSignal<>("Value");

Element input = new Element("input");
input.bindProperty("value", signal, value -> {
    System.out.println("Ignoring value change to " + value);
});
input.addPropertyChangeListener("value", "input", event -> {
    System.out.println("Property change to " + event.getValue());
});
getElement().appendChild(input);

add(new Button("Change signal value", click -> signal.set("Changed")));

add(new Span(signal));
  1. Edit the value in the field
  2. Observe that the write callback is invoked with the new value, but the value in the browser isn't restored to Value
  3. Click the button to observe that changes through the signal are still properly propagated to the client

Versions

  • Vaadin / Flow version: 25.1.0-rc2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions