fix: add custom timeout for the Duo Chat webview
Description
before | after |
---|---|
![]() |
![]() |
This is a temporary fix for when the Duo Chat webview fails to load within 10s for legitimate reasons (e.g. slow machine)
I took the route of undocumented gitlab.webviewTimeoutSeconds
config because we are planning o depercating the VS Code Duo Chat soon add I wanted to make this setting to go away we remove the legacy code.
Related Issues
Resolves Configure Timeout Time on VSCode Webview Startup (#1826 - closed)
How has this been tested?
Set "gitlab.webviewTimeoutSeconds": 20,
in your settings
See 2025-03-28T13:36:54:825 [info]: Setting Duo Chat webview timeout to 20000ms
in logs.
You can also apply this patch and test that without the 20s setting, the chat crashes
diff --git i/webviews/vue2/gitlab_duo_chat/src/App.vue w/webviews/vue2/gitlab_duo_chat/src/App.vue
index 84403db9..f650d40f 100644
--- i/webviews/vue2/gitlab_duo_chat/src/App.vue
+++ w/webviews/vue2/gitlab_duo_chat/src/App.vue
@@ -47,7 +47,8 @@ export default {
window.vsCodeApi = vscode;
window.addEventListener('message', this.handleExtensionMessageEvent);
console.log('Duo Chat Vue app component is reporting as ready');
- window.vsCodeApi.postMessage({ command: 'appReady' });
+ setTimeout(() =>
+ window.vsCodeApi.postMessage({ command: 'appReady' }), 15000);
console.log('Duo Chat Vue app component reported as ready');
},
onBeforeDestroy() {
Screenshots (if appropriate)
What CHANGELOG entry will this MR create?
-
fix:
Bug fix fixes - a user-facing issue in production - included in changelog -
feature:
New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:
(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog -
None - other non-user-facing changes
Edited by Tomas Vik (3 days until parental leave)