From 323fce85bf5ebc61ca52374555f86340bcfc547c Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 27 May 2025 16:53:05 +0200 Subject: [PATCH 1/3] Fix menu breaking when Roo is moved between primary and secondary sidebars Hello Roo Team! We changed this on the Kilo side and thought it might be useful to you! The menu buttons (Settings etc.) stop working when Roo is moved between the primary and secondary sidebars. This is because ClineProvider is prematurely disposed in that case This change prevents the ClineProvider from being disposed when hosted in a sidebar. It should still be disposed when hosted in a tab, because they have their own ClineProvider instance. Found while investigating https://github.com/Kilo-Org/kilocode/issues/502. --- src/core/webview/ClineProvider.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 13121531a7..b2aa17f6ed 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -339,7 +339,8 @@ export class ClineProvider this.view = webviewView // Set panel reference according to webview type - if ("onDidChangeViewState" in webviewView) { + const inTabMode = "onDidChangeViewState" in webviewView + if (inTabMode) { // Tag page type setPanel(webviewView, "tab") } else if ("onDidChangeVisibility" in webviewView) { @@ -441,7 +442,12 @@ export class ClineProvider // This happens when the user closes the view or when the view is closed programmatically webviewView.onDidDispose( async () => { - await this.dispose() + if (inTabMode) { + this.log("Disposing ClineProvider because it was in tab mode.") + await this.dispose() + } else { + this.log("NOT disposing ClineProvider because it is in sidebar mode and can be reused.") + } }, null, this.disposables, From ceabb08e7aba8ce9b694cd6f7c56e616f71a0b20 Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Wed, 28 May 2025 15:55:26 -0500 Subject: [PATCH 2/3] refactor: improve logging --- src/core/webview/ClineProvider.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index b2aa17f6ed..cba7b7713a 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -443,10 +443,11 @@ export class ClineProvider webviewView.onDidDispose( async () => { if (inTabMode) { - this.log("Disposing ClineProvider because it was in tab mode.") + this.log("Disposing ClineProvider instance for tab view") await this.dispose() } else { - this.log("NOT disposing ClineProvider because it is in sidebar mode and can be reused.") + this.log("Preserving ClineProvider instance for sidebar view reuse") + } } }, null, From 47dee850db3ccc5f930beda6b659f0cea73c1181 Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Wed, 28 May 2025 15:57:38 -0500 Subject: [PATCH 3/3] fix: extra bracket --- src/core/webview/ClineProvider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index cba7b7713a..932809202e 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -448,7 +448,6 @@ export class ClineProvider } else { this.log("Preserving ClineProvider instance for sidebar view reuse") } - } }, null, this.disposables,