From ae2700255e0cfe3ce838aa50bd8d32bbcf69f4b9 Mon Sep 17 00:00:00 2001 From: Will Lo Date: Thu, 17 Apr 2025 11:17:12 -0700 Subject: [PATCH 1/5] fix Q toolwindow possibly shows the wrong content --- .../services/amazonq/toolwindow/AmazonQToolWindowFactory.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt index f9279eb61b..a61fa43855 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt @@ -99,7 +99,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware { override fun onProfileSelected(myProject: Project, profile: QRegionProfile?) { if (project.isDisposed) return AmazonQToolWindow.getInstance(project).disposeAndRecreate() - qPanel.setContent(AmazonQToolWindow.getInstance(project).component) + prepareChatContent(project, qPanel) } } ) From b873c0dc6652089953d2655ff08f236503c10e51 Mon Sep 17 00:00:00 2001 From: Will Lo Date: Thu, 17 Apr 2025 11:38:49 -0700 Subject: [PATCH 2/5] cl --- .../bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json diff --git a/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json new file mode 100644 index 0000000000..dfeaaaa3f4 --- /dev/null +++ b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Q toolwindow potentially render chat UI when it's supposed to show auth UI and it makes users not able to complete setup" +} \ No newline at end of file From 33a953dac4c9c76d10d22afc4de0161144afdbdd Mon Sep 17 00:00:00 2001 From: Will Lo Date: Thu, 17 Apr 2025 12:38:47 -0700 Subject: [PATCH 3/5] patch --- .../services/amazonq/profile/QRegionProfileManager.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt index b3b242c363..54b5eebbb1 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt @@ -69,8 +69,9 @@ class QRegionProfileManager : PersistentStateComponent, Disposabl } if (profiles == null || profiles.none { it.arn == selected.arn }) { - invalidateProfile(selected.arn) + // Note that order matters, should switch to null first then invalidateProfile switchProfile(project, null, intent = QProfileSwitchIntent.Reload) + invalidateProfile(selected.arn) Telemetry.amazonq.profileState.use { span -> span.source(QProfileSwitchIntent.Reload.value) .amazonQProfileRegion(selected.region) From 9c48c010e71ad371bdbc321961eb5af0dc978071 Mon Sep 17 00:00:00 2001 From: Will Lo Date: Fri, 25 Apr 2025 09:22:35 -0700 Subject: [PATCH 4/5] changelog str --- .../bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json index dfeaaaa3f4..cb51d72e99 100644 --- a/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json +++ b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json @@ -1,4 +1,4 @@ { "type" : "bugfix", - "description" : "Q toolwindow potentially render chat UI when it's supposed to show auth UI and it makes users not able to complete setup" + "description" : "Fix issue where user can become stuck because Amazon Q Chat does not show authentication prompt" } \ No newline at end of file From c27036056dc2e284e27d01ae9f9798a8034679bb Mon Sep 17 00:00:00 2001 From: Will Lo Date: Mon, 28 Apr 2025 11:02:30 -0700 Subject: [PATCH 5/5] test --- .../jetbrains/services/amazonq/profile/QRegionProfileManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt index 27438c8efb..2ef300ff33 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt @@ -165,7 +165,7 @@ class QRegionProfileManager : PersistentStateComponent, Disposabl } private fun invalidateProfile(arn: String) { - val updated = connectionIdToActiveProfile.filterValues { it.arn != arn } + val updated = connectionIdToActiveProfile.filterValues { it != null && it.arn != arn } connectionIdToActiveProfile.clear() connectionIdToActiveProfile.putAll(updated) }