Ignore repeated confirms on the server selection screen

Tapping Continue and then the keyboard's Done key (or double tapping
Continue) started two server configurations. With a password-only server
both asked the flow to show the login screen, and the second request hit
the authentication state machine's unexpected transition fatalError.

Keep the running confirmation task and ignore further confirms until it
finishes, so the flow continues once. The guard clears afterwards so
confirming again after going back from the login screen still works.

Fixes ELEMENT-X-IOS-XED
This commit is contained in:
Mauro Romito
2026-10-15 11:28:04 +02:00
committed by Mauro
parent 11651bcd23
commit 09ecec4306
2 changed files with 41 additions and 5 deletions
@@ -20,6 +20,8 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
/// Debounces autocompletion from user input
private var debouncedAutocompleteTask: Task<Void, Never>?
/// The confirmation in progress, used to ignore repeated confirms (e.g. Continue then keyboard Done).
private var confirmTask: Task<Void, Never>?
private var actionsSubject: PassthroughSubject<ServerSelectionScreenViewModelAction, Never> = .init()
@@ -65,11 +67,15 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
guard state.textField != textField else { return } // stop the infinite loop
state.textField = textField
case .confirm:
switch state.mode {
case .userInput:
Task { await configureHomeserver() }
case .picker:
Task { await pickServer() }
guard confirmTask == nil else { return }
confirmTask = Task {
switch state.mode {
case .userInput:
await configureHomeserver()
case .picker:
await pickServer()
}
confirmTask = nil
}
case .clearFooterError:
clearFooterError()