Concurrency Fixes (#283)

* Review places where MainActor used

* Adapt to MainActor changes, avoid redundant task detachments

* Move Rust client operations into a dedicated concurrent queue, make init async

* Add changelog

* Fixed small working for awaiting non-async method

* Remove some redundant tasks

* Put back some main actors

* Fix tests

* Fixed timeline updates when the number of items doesn't change. Keeps more previous home screen room data between reloads

Co-authored-by: Stefan Ceriu <stefanc@matrix.org>
This commit is contained in:
ismailgulek
2022-11-02 18:25:46 +03:00
committed by GitHub
parent 965569aae2
commit f6a599a51b
19 changed files with 243 additions and 221 deletions
@@ -96,12 +96,13 @@ class StateStoreViewModel<State: BindableState, ViewAction> {
init(initialViewState: State) {
context = Context(initialViewState: initialViewState)
context.viewActions.sink { [weak self] action in
guard let self else { return }
Task { await self.process(viewAction: action) }
}
.store(in: &cancellables)
context.viewActions
.sink { [weak self] action in
guard let self else { return }
Task { await self.process(viewAction: action) }
}
.store(in: &cancellables)
}
/// Override to handles incoming `ViewAction`s from the `ViewModel`.