-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug 🐞
When using BindTo to hack a two way binding in a view that doesn't implement IViewFor, if BindTo is set up to observe on a nested property to sync to a view property and then back to push to this nested property on a separate BindTo, when the nesting property changes (e.g. NestedObj in MyViewModel.NestedObj.SomeText), the BindTo feeding back to the SomeText property pushes to SomeText in both the new and old NestedObj instances (the new one is pushed to first, then the old one, which I find quite surprising).
This is a problem if something is listening to changes on the old NestedObj and thinks something there has changed, when in reality it was abandoned, and no changes to it should have actually happened.
Using subscribe and manually assigning to the property does not trigger this issue.
Step to reproduce
- Start the WPF application
- Click on the 'Fetch Data' button
- See the 'Changed in ...' text box popping up twice, for two distinct NestedObject instances
- Comment the BindTo lines and uncomment the Subscribe lines
- Repeat 1 and 2
- See the 'Changed in ...' text box popping up only once, for the new NestedObject instance
Reproduction repository
https://github.com/lfpraca/ReactiveUiBindToBugRepro
Expected behavior
BindTo should push values to the new destination only
Screenshots 🖼️
No response
IDE
No response
Operating system
Windows
Version
11
Device
No response
ReactiveUI Version
22.3.1
Additional information ℹ️
No response