Skip to content

Commit 207a20b

Browse files
committed
RoomFlowNode: use newRoot instead of safeRoot as in this case it can create a race condition where we end up not switching node
1 parent 80cf8e7 commit 207a20b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import com.bumble.appyx.core.node.node
3232
import com.bumble.appyx.core.plugin.Plugin
3333
import com.bumble.appyx.core.plugin.plugins
3434
import com.bumble.appyx.navmodel.backstack.BackStack
35+
import com.bumble.appyx.navmodel.backstack.operation.newRoot
3536
import dagger.assisted.Assisted
3637
import dagger.assisted.AssistedInject
3738
import io.element.android.anvilannotations.ContributesNode
3839
import io.element.android.appnav.NodeLifecycleCallback
39-
import io.element.android.appnav.safeRoot
4040
import io.element.android.features.networkmonitor.api.NetworkMonitor
4141
import io.element.android.features.networkmonitor.api.NetworkStatus
4242
import io.element.android.libraries.architecture.BackstackNode
@@ -92,9 +92,9 @@ class RoomFlowNode @AssistedInject constructor(
9292
.distinctUntilChanged()
9393
.onEach { isLoaded ->
9494
if (isLoaded) {
95-
backstack.safeRoot(NavTarget.Loaded)
95+
backstack.newRoot(NavTarget.Loaded)
9696
} else {
97-
backstack.safeRoot(NavTarget.Loading)
97+
backstack.newRoot(NavTarget.Loading)
9898
}
9999
}.launchIn(lifecycleScope)
100100
}

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ class RustMatrixClient constructor(
165165
val cachedRoomListItem = roomListService.roomOrNull(roomId.value)
166166
val fullRoom = cachedRoomListItem?.fullRoom()
167167
if (cachedRoomListItem == null || fullRoom == null) {
168+
Timber.d("No room cached for $roomId")
168169
null
169170
} else {
171+
Timber.d("Found room cached for $roomId")
170172
Pair(cachedRoomListItem, fullRoom)
171173
}
172174
}

0 commit comments

Comments
 (0)