From e957932f39809630b4e9cc00ac5418857adadcdd Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Thu, 23 Jan 2025 15:51:37 -0800 Subject: [PATCH] avoid duplicate model listeners --- src/vs/workbench/contrib/void/browser/inlineDiffsService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts index 05920da4..d59f4d03 100644 --- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts +++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts @@ -259,6 +259,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { if (!(model.uri.fsPath in this.diffAreasOfURI)) { this.diffAreasOfURI[model.uri.fsPath] = new Set(); } + else return // do not add listeners to the same model twice - important, or will see duplicates // when the user types, realign diff areas and re-render them this._register( @@ -279,7 +280,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { .filter(diffArea => !!diffArea && diffArea.type === 'DiffZone') const isStreaming = diffZones.find(diffZone => !!diffZone._streamState.isStreaming) if (diffZones.length !== 0 && !isStreaming && !removeAcceptRejectAllUI) { - removeAcceptRejectAllUI = this._addAcceptRejectUI(uri) ?? null + removeAcceptRejectAllUI = this._addAcceptRejectAllUI(uri) ?? null } else { removeAcceptRejectAllUI?.() removeAcceptRejectAllUI = null @@ -393,7 +394,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { } } - private _addAcceptRejectUI(uri: URI) { + private _addAcceptRejectAllUI(uri: URI) { // find all diffzones that aren't streaming const diffZones: DiffZone[] = []