beforeReset

open suspend fun beforeReset()(source)

Called on the current logic instance just before the store is reset.

Override to clean up resources held by this logic instance — for example, running lifecycle handlers, releasing observers, or clearing caches — before the instance is discarded and a new one is created by Module.createLogic.

This is called after all operational coroutines have been cancelled and joined, but before modules are reinitialized. Suspend calls are safe here.

Example:

class MyLogic(private val storeAccessor: StoreAccessor) : ModuleLogic() {
private var observer: SomeObserver? = null

init {
observer = SomeObserver()
}

override suspend fun beforeReset() {
observer?.release()
observer = null
}
}