diff --git a/extensions/notebook/src/book/bookTreeView.ts b/extensions/notebook/src/book/bookTreeView.ts index 1d859dff99..4f993b5fe6 100644 --- a/extensions/notebook/src/book/bookTreeView.ts +++ b/extensions/notebook/src/book/bookTreeView.ts @@ -151,8 +151,10 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider book.bookPath === bookTreeItem.book.contentPath)?.getNotebook(bookTreeItem.book.contentPath); + let itemOpenedInBookTreeView = this.currentBook?.getNotebook(notebookUri) ?? this.books.find(book => book.bookPath === bookTreeItem.book.contentPath)?.getNotebook(notebookUri); if (itemOpenedInBookTreeView) { itemOpenedInBookTreeView.contextValue = bookTreeItem.contextValue; this._onDidChangeTreeData.fire(itemOpenedInBookTreeView.parent);