Binder detect changes after readBean


I have a problem with binder. After readBean() binder hasChanges() returns true. I don’t know why it happens.
It happens on forms with components based on ComboBoxes, and propably with custom components.
At first readBean() everything is ok, but after then, on every readBean() there is a problem with changes that has not been introduced by client.

Maybe the problem is with implementation of custom components? In my project they are simply base on HasValueAndElement interface, so maybe someone could explain me how the binder detects changes and what is the role of the HasValue.addValueChangeListener() in the binders changes detection proccess?

The problem has been solved by workaround.

I unregister listeners of fields related to binder, before readBean() and register them again after readBean().

Method binder.readBean() removes information of changes firstly, and after that initialize fields from entity. While initializing fields, listeners of modified fields can be fired. When that listeners modifies other fields, this is problem to binder.readBean() fields initialization process.
I supposed that, in my case, problem occurs when uninitialized fields are modified by listeners at binder.readBean() fields initialization process.

So i would recommend to others developers to think about whats going on in the form listeners when form is initializing.

But in my opinion there is a little incompatibility between binder.readBean() and binder.hasChanges() methods. As the documentation of hasChanges() states, that method should returns false after readBean(). It’s not always true.