Skip to content

Commit

Permalink
Merge pull request #3668 from element-hq/feature/bma/noNeedForLaunch
Browse files Browse the repository at this point in the history
No need to launch a coroutine here.
  • Loading branch information
bmarty authored Oct 15, 2024
2 parents ed9046f + 212e576 commit bfc1b88
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import dagger.assisted.Assisted
Expand All @@ -33,7 +32,6 @@ import io.element.android.libraries.matrix.api.room.powerlevels.canInvite
import io.element.android.libraries.matrix.api.room.roomMembers
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class RoomMemberListPresenter @AssistedInject constructor(
Expand All @@ -50,7 +48,6 @@ class RoomMemberListPresenter @AssistedInject constructor(

@Composable
override fun present(): RoomMemberListState {
val coroutineScope = rememberCoroutineScope()
var roomMembers: AsyncData<RoomMembers> by remember { mutableStateOf(AsyncData.Loading()) }
var searchQuery by rememberSaveable { mutableStateOf("") }
var searchResults by remember {
Expand Down Expand Up @@ -135,13 +132,12 @@ class RoomMemberListPresenter @AssistedInject constructor(
when (event) {
is RoomMemberListEvents.OnSearchActiveChanged -> isSearchActive = event.active
is RoomMemberListEvents.UpdateSearchQuery -> searchQuery = event.query
is RoomMemberListEvents.RoomMemberSelected -> coroutineScope.launch {
is RoomMemberListEvents.RoomMemberSelected ->
if (roomModerationState.canDisplayModerationActions) {
roomModerationState.eventSink(RoomMembersModerationEvents.SelectRoomMember(event.roomMember))
} else {
navigator.openRoomMemberDetails(event.roomMember.userId)
}
}
}
}

Expand Down

0 comments on commit bfc1b88

Please sign in to comment.