-
Notifications
You must be signed in to change notification settings - Fork 731
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
Fixes Room List not getting updated when fragment is not in focus #7186
Conversation
.onEach { | ||
setState { copy(roomsPagedList = it) } | ||
} | ||
.flowOn(Dispatchers.Default) |
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.
No need to change dispatcher for this
roomListViewModel.onEach(HomeRoomListViewState::roomsPagedList) { roomsList -> | ||
roomsList?.let { | ||
roomsController.submitList(it) | ||
if (it.isEmpty()) { |
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.
It's a bit weird to have both call to roomsController, this should be his responsability to handle empty list
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.
What exactly do you mean? The problem here is that there are different empty states for different tabs, so we need to force rebuild models, to show different empty state view. But I can just create method in controller and move this code there 🤔
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.
The controller should be able to handle this regarding the ViewState, but keep it like this for now.
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.
there are different empty states for different tabs, so we need to force rebuild models, to show different empty state view
This should be a comment in the code, since this is not usual to call requestForcedModelBuild()
SonarCloud Quality Gate failed. |
|
||
roomsFlowJob = liveResults.livePagedList | ||
.asFlow() | ||
.onEach { |
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.
Nit: you could use setOnEach
Type of change
Content
We had a bug where if you join or leave a room from an activity/fragment other than room list, the list would often not update and would sometimes also crash. This fixes that by converting the room paged list livedata instead of passing livedata in a mavericks state update and observing it there
Motivation and context
Fixes #7152
Screenshots / GIFs
Tests
Try the above scenario but also for joining rooms
Tested devices
Checklist