-
Notifications
You must be signed in to change notification settings - Fork 912
Ensure getRootSpaceSummaries() is not called on the main thread.
#5835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
cd06ba6
fb73628
d2eca73
abdfd9d
c542619
b2f9d67
da656ac
ebcab18
6b5822e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,7 +296,7 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa | |
| communityGroups | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should rename this to spaceList
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, but I wanted to limit the number of changes for the hotfix |
||
| } | ||
| .execute { async -> | ||
| val rootSpaces = session.spaceService().getRootSpaceSummaries() | ||
| val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my side this is equivalent, but I do not have any spaces with child space. I will create some
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, it works as expected |
||
| val orders = rootSpaces.map { | ||
| it.roomId to session.getRoom(it.roomId) | ||
| ?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
not for this PR as it would introduce lots of changes, but worth highlighting in case we want guard against other cases
from my understanding the general approach of coroutines scoping is to define the context switching at the lowest possible level, which in this case would be
we already have a similar wrapper for awaitTransaction
this would also force non coroutine based usages to rely on
runBlocking, which would have the benefit of make finding the usages a bit easierThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we might want to dispatch querying db to a background thread, to avoid blocking the dispatcher, as Retrofit does for request (and probably Room)