From 7b35fb38190a500ca28a5c596736fed5570bbee2 Mon Sep 17 00:00:00 2001 From: Sriram Date: Wed, 20 Aug 2025 01:55:24 -0400 Subject: [PATCH] fix(explorer): Refresh s3 node on profile switch (#7401, #7665) ## Problem When a connection is changed, the awsClientBuilderV3 is used to get the service details, and a cache is being used to cache the service. However, in the cache key only region is cached along with other service details, so on profile switch it is still returning the same cached service of previous profile. ## Solution Retrieved current profile using global aws context, and added it to the cache key, so when profile is switched, cache is updated and service from new profile is retrieved. --- packages/core/src/shared/awsClientBuilderV3.ts | 2 ++ .../Bug Fix-6318dec2-72a8-4464-ab84-e51913624f8c.json | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 packages/toolkit/.changes/next-release/Bug Fix-6318dec2-72a8-4464-ab84-e51913624f8c.json diff --git a/packages/core/src/shared/awsClientBuilderV3.ts b/packages/core/src/shared/awsClientBuilderV3.ts index c51cc009e91..9526b7df344 100644 --- a/packages/core/src/shared/awsClientBuilderV3.ts +++ b/packages/core/src/shared/awsClientBuilderV3.ts @@ -120,10 +120,12 @@ export class AWSClientBuilderV3 { private keyAwsService(serviceOptions: AwsServiceOptions): string { // Serializing certain objects in the args allows us to detect when nested objects change (ex. new retry strategy, endpoints) + const profileId = this.context.getCredentialProfileName() return [ String(serviceOptions.serviceClient), JSON.stringify(serviceOptions.clientOptions), serviceOptions.region, + profileId, serviceOptions.userAgent ? '1' : '0', serviceOptions.settings ? JSON.stringify(serviceOptions.settings.get('endpoints', {})) : '', ].join(':') diff --git a/packages/toolkit/.changes/next-release/Bug Fix-6318dec2-72a8-4464-ab84-e51913624f8c.json b/packages/toolkit/.changes/next-release/Bug Fix-6318dec2-72a8-4464-ab84-e51913624f8c.json new file mode 100644 index 00000000000..d1afd281fb5 --- /dev/null +++ b/packages/toolkit/.changes/next-release/Bug Fix-6318dec2-72a8-4464-ab84-e51913624f8c.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "S3 node in explorer is not refreshed on profile change" +}