Skip to content

Commit 57038b7

Browse files
Fix menu breaking when Roo is moved between primary and secondary sidebars (#4045)
* 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 Kilo-Org/kilocode#502. * refactor: improve logging * fix: extra bracket --------- Co-authored-by: Daniel <[email protected]>
1 parent 2e5a1a8 commit 57038b7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ export class ClineProvider
339339
this.view = webviewView
340340

341341
// Set panel reference according to webview type
342-
if ("onDidChangeViewState" in webviewView) {
342+
const inTabMode = "onDidChangeViewState" in webviewView
343+
if (inTabMode) {
343344
// Tag page type
344345
setPanel(webviewView, "tab")
345346
} else if ("onDidChangeVisibility" in webviewView) {
@@ -441,7 +442,12 @@ export class ClineProvider
441442
// This happens when the user closes the view or when the view is closed programmatically
442443
webviewView.onDidDispose(
443444
async () => {
444-
await this.dispose()
445+
if (inTabMode) {
446+
this.log("Disposing ClineProvider instance for tab view")
447+
await this.dispose()
448+
} else {
449+
this.log("Preserving ClineProvider instance for sidebar view reuse")
450+
}
445451
},
446452
null,
447453
this.disposables,

0 commit comments

Comments
 (0)