diff --git a/extensions/notebook/src/book/bookTreeView.ts b/extensions/notebook/src/book/bookTreeView.ts index 17df14203d..afe4e48a40 100644 --- a/extensions/notebook/src/book/bookTreeView.ts +++ b/extensions/notebook/src/book/bookTreeView.ts @@ -203,8 +203,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider void) { const isResourceChange = resource !== this._resource; if (isResourceChange) { - clearTimeout(this._throttleTimer); - this._throttleTimer = undefined; + this.clearAndResetThrottleTimer(); } this._resource = resource; @@ -214,11 +213,19 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider action(), 300); + this._throttleTimer = setTimeout(() => { + action(); + this.clearAndResetThrottleTimer(); + }, 300); } } } + private clearAndResetThrottleTimer(): void { + clearTimeout(this._throttleTimer); + this._throttleTimer = undefined; + } + openExternalLink(resource: string): void { try { vscode.env.openExternal(vscode.Uri.parse(resource));