You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a mutable bean as the value of a server-side ValueSignal, then changes made to that object will be seen by new subscribers but not by old subscribers which may in turn lead to lots of confusion.
Expected-behavior
Expected that the value signal creates its own copy of the data so that future changes to the original instance will be ignored by the signal. This should probably be done so that the value field in ValueSignal is a com.fasterxml.jackson.databind.JsonNode instead of T. This would also have the benefit that comparisons done by compareAndSet would always be based only on JSON equality rather than using the object's own equals() implementation which might not be consistent with comparisons done in the browser.
Reproduction
Service:
@BrowserCallable
@AnonymousAllowed
public class CountService {
public static class Holder {
private int value;
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
}
private Holder holder = new Holder();
private ValueSignal<Holder> signal = new ValueSignal<>(holder, Holder.class);
public ValueSignal<Holder> signal() {
return signal;
}
public void updateValue() {
holder.value++;
}
}
Describe the bug
If you have a mutable bean as the value of a server-side
ValueSignal
, then changes made to that object will be seen by new subscribers but not by old subscribers which may in turn lead to lots of confusion.Expected-behavior
Expected that the value signal creates its own copy of the data so that future changes to the original instance will be ignored by the signal. This should probably be done so that the
value
field inValueSignal
is acom.fasterxml.jackson.databind.JsonNode
instead ofT
. This would also have the benefit that comparisons done bycompareAndSet
would always be based only on JSON equality rather than using the object's ownequals()
implementation which might not be consistent with comparisons done in the browser.Reproduction
Service:
View:
Steps:
System Info
Vaadin 24.5.0.beta4
The text was updated successfully, but these errors were encountered: