fengdai
08/02/2022, 8:51 AMval globalWriteObserverHandler = Snapshot.registerGlobalWriteObserver {
println("on global written")
Snapshot.sendApplyNotifications()
}
val applyObserverHandler = Snapshot.registerApplyObserver { set, _ ->
println("on applied - $set")
}
val count = mutableStateOf(0)
count.value = 1
globalWriteObserverHandler.dispose()
applyObserverHandler.dispose()
...
val count = mutableStateOf(0)
// added this line
Snapshot.takeSnapshot().dispose()
count.value = 1
...
Dose anyone know the reason?fun <T : StateRecord> T.overwritableRecord
.
internal fun <T : StateRecord> T.overwritableRecord(
state: StateObject,
snapshot: Snapshot,
candidate: T
): T {
...
if (candidate.snapshotId == id) return candidate
...
snapshot.recordModified(state)
return newData
}
When candidate record is found, it returns, without calling recordModified
. Is this expected? If yes, what the reason?Zach Klippenstein (he/him) [MOD]
08/03/2022, 7:08 PMfengdai
08/04/2022, 12:59 PMZach Klippenstein (he/him) [MOD]
08/04/2022, 4:54 PMfengdai
08/05/2022, 12:07 AMinitializeObjects
? I’m guessing you mean notifyObjectsInitialized
. And it works. Thanks very much!Zach Klippenstein (he/him) [MOD]
08/05/2022, 6:10 PM