Description
When switching entries in the File History view, the first activation change results in:
This occurs before the actual editor becomes active. The current logic only debounces the change when the URI is virtual:
|
// If we are losing the active editor, give more time before assuming its really gone |
|
// For virtual repositories the active editor event takes a while to fire |
|
// Ultimately we need to be using the upcoming Tabs api to avoid this |
|
if (editor == null && isVirtualUri(this._uri)) { |
|
this._triggerChangeDebounced ??= debounce(() => this.triggerChange(), 1500); |
|
void this._triggerChangeDebounced(); |
|
return; |
|
} |
Problem
In the File History view, the first activation event always has editor === undefined, but the associated URI is not a virtual URI.
Because of the isVirtualUri(this._uri) condition, the debounce path is skipped, and triggerChange() fires immediately.
This causes the File History view to refresh too early, before the editor has stabilized, leading to an unintended refresh on the same file.
Should the isVirtualUri condition be removed so that changes are always debounced when editor is undefined?
Description
When switching entries in the File History view, the first activation change results in:
This occurs before the actual editor becomes active. The current logic only debounces the change when the URI is virtual:
vscode-gitlens/src/views/nodes/fileHistoryTrackerNode.ts
Lines 146 to 153 in 14df288
Problem
In the File History view, the first activation event always has
editor === undefined, but the associated URI is not a virtual URI.Because of the
isVirtualUri(this._uri)condition, the debounce path is skipped, andtriggerChange()fires immediately.This causes the File History view to refresh too early, before the editor has stabilized, leading to an unintended refresh on the same file.
Should the isVirtualUri condition be removed so that changes are always debounced when editor is undefined?