Skip to content

Commit c238710

Browse files
refactor(auth): dont manual refresh auth webview on hide (aws#6836)
## Problem: We have an explicit force refresh of the auth webview when it is shown/hidden. There is not an obvious reason why we do this. This causes problems since we expect that show/hiding of the webview does not trigger any functional changes since we have configured the webview to continue running even while hidden. This means that our handlers for auth changes are still running even when auth is hidden. For my specific issue, by force reloading the webview on every show/hide it triggered the webview loading code each time, causing webview telemetry events to be triggered more than expected. ## Solution: Remove the force reload line. With this change we can move the edge case handling code which throttled the telemetry emitted when it was triggered on every hide/show. I've done manual testing and have not noted any obvious regressions to the expected user flow. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
1 parent 8afcc81 commit c238710

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

packages/core/src/login/webview/commonAuthViewProvider.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ export class CommonAuthViewProvider implements WebviewViewProvider {
124124
}
125125

126126
this.onDidChangeVisibility?.fire(webviewView.visible)
127-
// force webview to reload
128-
await vscode.commands.executeCommand('workbench.action.webview.reloadWebviewAction')
129127
})
130128

131129
const dist = Uri.joinPath(this.extensionContext.extensionUri, 'dist')

packages/core/src/login/webview/vue/backend.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,18 @@ export abstract class CommonAuthWebview extends VueWebview {
6161
return globals.regionProvider.getRegions().reverse()
6262
}
6363

64-
private didCall: { login: boolean; reauth: boolean } = { login: false, reauth: false }
6564
/**
6665
* Called when the UI load process is completed, regardless of success or failure
6766
*
6867
* @param errorMessage IF an error is caught on the frontend, this is the message. It will result in a failure metric.
6968
* Otherwise we assume success.
7069
*/
7170
public setUiReady(state: 'login' | 'reauth', errorMessage?: string) {
72-
// Only emit once to prevent telemetry spam, since showing/hiding chat triggers this each time.
73-
// TODO: Research how to not trigger this on every show/hide
74-
if (this.didCall[state]) {
75-
return
76-
}
77-
7871
if (errorMessage) {
7972
this.setLoadFailure(state, errorMessage)
8073
} else {
8174
this.setDidLoad(state)
8275
}
83-
84-
this.didCall[state] = true
8576
}
8677

8778
/**

0 commit comments

Comments
 (0)