Fix: Replace terminal view lifecycle hack with Event.once

This commit is contained in:
Murat Aslan
2026-01-02 15:43:55 +03:00
parent 52bec723e4
commit fbb59af76a
@@ -337,10 +337,8 @@ export class TerminalViewPane extends ViewPane {
// be focused. So wait for connection to finish, then focus.
const previousActiveElement = this.element.ownerDocument.activeElement;
if (previousActiveElement) {
// TODO: Improve lifecycle management this event should be disposed after first fire
this._register(this._terminalService.onDidChangeConnectionState(() => {
this._register(Event.once(this._terminalService.onDidChangeConnectionState)(() => {
// Only focus the terminal if the activeElement has not changed since focus() was called
// TODO: Hack
if (previousActiveElement && dom.isActiveElement(previousActiveElement)) {
this._terminalGroupService.showPanel(true);
}