https://kotlinlang.org logo
Title
t

Tash

11/29/2021, 9:24 PM
Experimenting with using SnapshotState APIs in Android View-only rendering world (just including the compose runtime artifact). Using
snapshotFlow
to observe `mutableStateOf<T>`s in `Fragment`s. Noticing that
withMutableSnapshot
is required when updating the state (from Android View callbacks for example) in order to propagate updates, but I don’t understand why it’s required in this case… 🤔
a

Arsen

11/29/2021, 11:23 PM
iirc Snapshot system should be notified in order to apply pending changes, which ui part of compose periodically does. Checkout Snapshot.sendApplyNotifications() method
t

Tash

11/30/2021, 7:13 AM
Yeah, that's where I didn't completely understand how global snapshot advancement happens (via sendApplyNotifications) Started looking at
GlobalSnapshotManager
and apparently it's "started" in the
ViewGroup.setContent(...)
entry point, so that's a clue