Skip to content

Commit e313f45

Browse files
authored
fix: go to previous step when connection fails (coder#77)
- happens when an error is encountered during connection (like exceptions caused by an expired token) - right now the auth wizard stays on the last step. - with this changeset the auth steps reset to the initial sign in for auto-connect, or it goes back one step back to the token input step for manual authentication
1 parent a509615 commit e313f45

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
- action buttons on the token input step were swapped to achieve better keyboard navigation
1212

13+
### Fixed
14+
15+
- authorization wizard automatically goes to a previous screen when an error is encountered during connection to Coder deployment
16+
1317
## 0.1.3 - 2025-04-09
1418

1519
### Fixed

src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AuthWizardPage(
2222

2323
private val signInStep = SignInStep(context)
2424
private val tokenStep = TokenStep(context)
25-
private val connectStep = ConnectStep(context, shouldAutoLogin, this::notify, onConnect)
25+
private val connectStep = ConnectStep(context, shouldAutoLogin, this::notify, this::displaySteps, onConnect)
2626

2727

2828
/**

src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ConnectStep(
2727
private val context: CoderToolboxContext,
2828
private val shouldAutoLogin: StateFlow<Boolean>,
2929
private val notify: (String, Throwable) -> Unit,
30+
private val refreshWizard: () -> Unit,
3031
private val onConnect: (
3132
client: CoderRestClient,
3233
cli: CoderCLIManager,
@@ -102,9 +103,13 @@ class ConnectStep(
102103
} catch (ex: CancellationException) {
103104
if (ex.message != USER_HIT_THE_BACK_BUTTON) {
104105
notify("Connection to ${url.host} was configured", ex)
106+
onBack()
107+
refreshWizard()
105108
}
106109
} catch (ex: Exception) {
107110
notify("Failed to configure ${url.host}", ex)
111+
onBack()
112+
refreshWizard()
108113
}
109114
}
110115
}

0 commit comments

Comments
 (0)