From 1fbfdf6c02ed9084ddc6a96dd65e2c6cc97ec1bf Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Thu, 1 May 2025 23:42:47 +0300 Subject: [PATCH 1/2] fix: misleading "No workspaces yet" during manual authentication There is a brief moment between manual authentication and workspace poller initialization and execution where we see a "No workspaces yet" which is misleading. Instead, a loading indicator/message should be displayed. --- CHANGELOG.md | 4 ++++ src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 058e1f0..bba3be9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - ssh configuration is simplified, background hostnames have been discarded. +### Fixed + +- misleading message saying that there are no workspaces rendered during manual authentication + ## 0.2.0 - 2025-04-24 ### Added diff --git a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt index 4ccce7e..e2cb096 100644 --- a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt +++ b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt @@ -262,6 +262,9 @@ class CoderRemoteProvider( // start initialization with the new settings this@CoderRemoteProvider.client = restClient coderHeaderPage = NewEnvironmentPage(context, context.i18n.pnotr(restClient.url.toString())) + environments.update { + LoadableState.Loading + } pollJob = poll(restClient, cli) } } @@ -326,6 +329,10 @@ class CoderRemoteProvider( context.secrets.rememberMe = true this.client = client pollJob?.cancel() + + environments.update { + LoadableState.Loading + } pollJob = poll(client, cli) goToEnvironmentsPage() } From 2c7824bf9f71298d3513e68d622d24f75425fb45 Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Fri, 2 May 2025 00:10:36 +0300 Subject: [PATCH 2/2] refactor: abstract logic for better readability --- .../kotlin/com/coder/toolbox/CoderRemoteProvider.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt index e2cb096..2cdbaf9 100644 --- a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt +++ b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt @@ -262,9 +262,7 @@ class CoderRemoteProvider( // start initialization with the new settings this@CoderRemoteProvider.client = restClient coderHeaderPage = NewEnvironmentPage(context, context.i18n.pnotr(restClient.url.toString())) - environments.update { - LoadableState.Loading - } + environments.showLoadingMessage() pollJob = poll(restClient, cli) } } @@ -329,11 +327,14 @@ class CoderRemoteProvider( context.secrets.rememberMe = true this.client = client pollJob?.cancel() + environments.showLoadingMessage() + pollJob = poll(client, cli) + goToEnvironmentsPage() + } - environments.update { + private fun MutableStateFlow>>.showLoadingMessage() { + this.update { LoadableState.Loading } - pollJob = poll(client, cli) - goToEnvironmentsPage() } }