Experimenting with using SnapshotState APIs in And...
# compose
t
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
iirc Snapshot system should be notified in order to apply pending changes, which ui part of compose periodically does. Checkout Snapshot.sendApplyNotifications() method
t
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