mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
RoomFlowNode: use newRoot instead of safeRoot as in this case it can create a race condition where we end up not switching node
This commit is contained in:
@@ -32,11 +32,11 @@ import com.bumble.appyx.core.node.node
|
|||||||
import com.bumble.appyx.core.plugin.Plugin
|
import com.bumble.appyx.core.plugin.Plugin
|
||||||
import com.bumble.appyx.core.plugin.plugins
|
import com.bumble.appyx.core.plugin.plugins
|
||||||
import com.bumble.appyx.navmodel.backstack.BackStack
|
import com.bumble.appyx.navmodel.backstack.BackStack
|
||||||
|
import com.bumble.appyx.navmodel.backstack.operation.newRoot
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.element.android.anvilannotations.ContributesNode
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
import io.element.android.appnav.NodeLifecycleCallback
|
import io.element.android.appnav.NodeLifecycleCallback
|
||||||
import io.element.android.appnav.safeRoot
|
|
||||||
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
||||||
import io.element.android.features.networkmonitor.api.NetworkStatus
|
import io.element.android.features.networkmonitor.api.NetworkStatus
|
||||||
import io.element.android.libraries.architecture.BackstackNode
|
import io.element.android.libraries.architecture.BackstackNode
|
||||||
@@ -92,9 +92,9 @@ class RoomFlowNode @AssistedInject constructor(
|
|||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.onEach { isLoaded ->
|
.onEach { isLoaded ->
|
||||||
if (isLoaded) {
|
if (isLoaded) {
|
||||||
backstack.safeRoot(NavTarget.Loaded)
|
backstack.newRoot(NavTarget.Loaded)
|
||||||
} else {
|
} else {
|
||||||
backstack.safeRoot(NavTarget.Loading)
|
backstack.newRoot(NavTarget.Loading)
|
||||||
}
|
}
|
||||||
}.launchIn(lifecycleScope)
|
}.launchIn(lifecycleScope)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -165,8 +165,10 @@ class RustMatrixClient constructor(
|
|||||||
val cachedRoomListItem = roomListService.roomOrNull(roomId.value)
|
val cachedRoomListItem = roomListService.roomOrNull(roomId.value)
|
||||||
val fullRoom = cachedRoomListItem?.fullRoom()
|
val fullRoom = cachedRoomListItem?.fullRoom()
|
||||||
if (cachedRoomListItem == null || fullRoom == null) {
|
if (cachedRoomListItem == null || fullRoom == null) {
|
||||||
|
Timber.d("No room cached for $roomId")
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
|
Timber.d("Found room cached for $roomId")
|
||||||
Pair(cachedRoomListItem, fullRoom)
|
Pair(cachedRoomListItem, fullRoom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user