fix: report a runtime property chain's initial value once when a link emits on subscribe - #162
Merged
Merged
Conversation
… emits on subscribe - Ignore a link notification raised from inside its own subscribe. The chain reads the same value straight after. - WhenAnyValueUnsafe, WhenChanged and the Unsafe bindings report one initial value through a property with no change notification. - BindUnsafe does not write the view's value back to the view model when the binding is created. Fixes #160
glennawatson
enabled auto-merge (squash)
October 1, 2026 06:09
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #162 +/- ##
=======================================
Coverage 99.23% 99.23%
=======================================
Files 396 396
Lines 14467 14469 +2
Branches 2065 2065
=======================================
+ Hits 14357 14359 +2
Misses 110 110 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
A runtime property chain reports its initial value once, even when a link has no change notification.
WhenAnyValueUnsafe,WhenChangedand the other reflection-based observations report one initial value. This holds when a link in the chain is a plain property with no change notification.BindUnsafedoes not write back to the view model when the binding is created. This holds when the view raises no change notification of its own.Why
A link that emits as soon as you subscribe produced a second initial value.
isDistinctdid not collapse the repeat. WithskipInitial, the chain still let the initial value through.Closes #160
Breaking changes
None
How this was verified
skipInitial. They also cover a two-way binding through a view that raises no notification.Notes for the reviewer
The whole fix is in
ExpressionChainSink.cs.Subscribeon the same thread can see it. Notifications from other threads still wait on the lock and are delivered as before.Checklist