Skip to content

Debounced triggerChange not firing on first file switch in File History view #5137

Description

@wolfsilver

Description

When switching entries in the File History view, the first activation change results in:

editor = undefined

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds to be looked at

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions