Prevent crashes when tapping multiple space children in the spaces tab

Also introduce logs for SpaceFlowCoordinator state machine transitions
This commit is contained in:
Stefan Ceriu
2026-02-03 13:44:26 +02:00
committed by Stefan Ceriu
parent 8271060261
commit 0b994002cc

View File

@@ -244,6 +244,16 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
selectedSpaceRoomSubject.send(nil)
}
stateMachine.addRouteMapping { event, fromState, _ in
guard case .startRoomFlow = event, case .roomFlow = fromState else {
return nil
}
return fromState
} handler: { _ in
// Ignore tapping on multiple rooms at the same time
}
stateMachine.addRouteMapping { event, fromState, _ in
guard case .startRoomFlow = event, case .space = fromState else { return nil }
return .roomFlow(previousState: fromState)
@@ -331,6 +341,14 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.addErrorHandler { context in
fatalError("Unexpected transition: \(context)")
}
stateMachine.addAnyHandler(.any => .any) { context in
if let event = context.event {
MXLog.info("Transitioning from `\(context.fromState)` to `\(context.toState)` with event `\(event)`")
} else {
MXLog.info("Transitioning from \(context.fromState)` to `\(context.toState)`")
}
}
}
private func presentSpace() {