-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
d: stackoverflowGood question for Stack OverflowGood question for Stack Overflow
Description
ValueNotifier, for example, doesn't notify in the case that
SomeProto a = new SomeProto();
a.setSomeInt(5);
SomeProto b = new SomeProto();
b.setSomeInt(5);
valueNotifier_ = a; // listeners are notified.
valueNotifier_ = b; // listeners are not notified.
The cause of this surprising behavior is that ValueNotifier uses the == operator of the contained object to determine whether the value has changed.
The description of ValueNotifier says "When the value is replaced, this class notifies its listeners", which suggests that this is not the intended behavior in this case (and, indeed, if the notifier were supposed to be triggered only on inner content changing then the current behavior also fails at that, since
valueNotifier_ = a;
a.setSomeInt(6);
would not provoke a notification.)
I have a patch that fixes this and adds a test, will make a PR shortly.
Metadata
Metadata
Assignees
Labels
d: stackoverflowGood question for Stack OverflowGood question for Stack Overflow