vide
07/28/2023, 11:32 AMGlobalSnapshotManager
which calls Snapshot.registerGlobalWriteObserver
, which then calls Snapshot.sendApplyNotifications()
on the Main dispatcher. This seems to make sense as writes to the global snapshot don't generate apply notifications, but what bothers me is that there's a few other places where Snapshot.sendApplyNotifications
is called as well: for example in Recomposer.kt, WindowInsets.android.kt, SubComposeLayout.kt and ComposeViewAdapter.kt. Why are the explicit calls there required? Wouldn't all possible State writes eventually call apply observers when either 1) applying the snapshot to the global snapshot, or 2) triggering the global write observer?vide
07/28/2023, 11:36 AMvide
07/28/2023, 11:38 AMStylianos Gakis
07/28/2023, 11:46 AMsendApplyNotifications
say “This method is implicitly called whenever a non-nested MutableSnapshot is applied making its changes visible to all new, non-nested snapshots.“. Could it be that for some scenarios you are actually in the “nested MutableSnapshot” scenario, so it’s not auto-applied? Maybe WindowInsets does that for example, takes a nested snapshot, does its thing, and then calls sendApplyNotifications?vide
07/28/2023, 11:54 AM