Repository navigation
Refresh views from any Observable type, not just Skip-aware ones - #174
Draft
piercifani wants to merge 1 commit into
Draft
piercifani wants to merge 1 commit into
piercifani wants to merge 1 commit into
Conversation
Evaluate bridged view bodies, and content evaluated after them (lazy ForEach items, navigationDestination(for:), GeometryReader, ScrollViewReader, AsyncImage and Binding reads from Compose), inside withObservationTracking. Types on the stock Observation registrar, such as third-party models, now refresh views on Android. BodyObservationTracking.isEnabled is an escape hatch. Requires skip-model 1.9.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 23, 2026
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.
Today a Fuse view refreshes only when it reads a Skip-aware model: one whose
@Observableexpanded against Skip's bridgedObservationRegistrar. Types that use the stockObservationmodule never invalidate Compose. That covers models in modules without the Skip plugin, hand-writtenObservableconformances, and libraries built onObservable(swift-sharing, sqlite-data, and soon TCA). On Android those views silently go stale.This change runs bridged view evaluation inside
withObservationTracking, the same mechanism SwiftUI uses. AnyObservableread refreshes the view on change, regardless of which registrar it uses.Java_withBodyObservationTracking: called by skipstone-generatedSwift_composableBody. It subscribes the current recompose scope throughskip.model.trackBodyInvalidation()(one JNI call) and invalidates it fromonChange, which may run on any thread.bodyreturns is wrapped too: lazyForEachitems,navigationDestination(for:),GeometryReader,ScrollViewReader,AsyncImage, andBinding.wrappedValue. TheBindingwrap covers controls that read a binding only from Compose, such as aToggle.BodyObservationTracking.isEnabled(defaulttrue) is an escape hatch.Skip-aware models keep working unchanged: they now invalidate through both paths, which is harmless.
Cost: about 3.4 µs per tracked evaluation in a release build on a Pixel 10 Pro Fold. For comparison, a bridged property read is about 0.74 µs and Observation alone is about 1.35 µs.
Limitations:
withAnimationwrites to non-Skip-aware models refresh the view but do not animate.Tests:
testStockObservableRefreshesViewscovers the body, a lazy row, and a binding-onlyToggle.testStockObservableIsStaleWithTrackingDisabledis the control.Requires skip-model 1.9.0. Part of https://github.com/orgs/skiptools/discussions/755.
Related PRs (release in this order):
🤖 Generated with Claude Code