Change:
it needs the to work but that only comes in when is called then why is the scheduler not created from and associated code that calls it? the scheduler is never disposed

Discussion:
static readonly NAME = nls.localize({ key: 'openEditors', comment: ['Open is an adjective'] }, "Open Editors"); private dirtyCountElement!: HTMLElement; <del> private listRefreshScheduler: RunOnceScheduler; </del> <ins> private listRefreshScheduler: RunOnceScheduler | undefined; </ins> private structuralRefreshDelay: number; private list!: WorkbenchList<OpenEditor | IEditorGroup>; private listLabels: ResourceLabels | undefined;

super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService); this.structuralRefreshDelay = 0; <del> let labelChangeListeners: IDisposable[] = []; this.listRefreshScheduler = new RunOnceScheduler(() => { // No need to refresh the list if it's not rendered if (!this.list) { return; } labelChangeListeners = dispose(labelChangeListeners); const previousLength = this.list.length; const elements = this.getElements(); this.list.splice(0, this.list.length, elements); this.focusActiveEditor(); if (previousLength !== this.list.length) { this.updateSize(); } this.needsRefresh = false; if (this.sortOrder === 'alphabetical' || this.sortOrder === 'fullPath') { // We need to resort the list if the editor label changed elements.forEach(e => { if (e instanceof OpenEditor) { labelChangeListeners.push(e.editor.onDidChangeLabel(() => this.listRefreshScheduler.schedule())); } }); } }, this.structuralRefreshDelay); </del> this.sortOrder = configurationService.getValue('explorer.openEditors.sortOrder'); this.registerUpdateEvents();

return; } <del> this.listRefreshScheduler.schedule(this.structuralRefreshDelay); </del> <ins> this.listRefreshScheduler?.schedule(this.structuralRefreshDelay); </ins> }; const groupDisposables = new Map<number, IDisposable>(); const addGroupListener = (group: IEditorGroup) => { const groupModelChangeListener = group.onDidModelChange(e => { <del> if (this.listRefreshScheduler.isScheduled()) { </del> <ins> if (this.listRefreshScheduler?.isScheduled()) { </ins> return; } if (!this.isBodyVisible() || !this.list) {

this._register(this.list); this._register(this.listLabels); <ins> // Register the refresh scheduler let labelChangeListeners: IDisposable[] = []; this.listRefreshScheduler = this._register(new RunOnceScheduler(() => { // No need to refresh the list if it's not rendered if (!this.list) { return; } labelChangeListeners = dispose(labelChangeListeners); const previousLength = this.list.length; const elements = this.getElements(); this.list.splice(0, this.list.length, elements); this.focusActiveEditor(); if (previousLength !== this.list.length) { this.updateSize(); } this.needsRefresh = false; if (this.sortOrder === 'alphabetical' || this.sortOrder === 'fullPath') { // We need to resort the list if the editor label changed elements.forEach(e => { if (e instanceof OpenEditor) { labelChangeListeners.push(e.editor.onDidChangeLabel(() => this.listRefreshScheduler?.schedule())); } }); } }, this.structuralRefreshDelay)); </ins> this.updateSize(); // Bind context keys

this._register(this.onDidChangeBodyVisibility(visible => { if (visible && this.needsRefresh) { <del> this.listRefreshScheduler.schedule(0); </del> <ins> this.listRefreshScheduler?.schedule(0); </ins> } }));

// Trigger a 'repaint' when decoration settings change or the sort order changed if (event.affectsConfiguration('explorer.decorations') || event.affectsConfiguration('explorer.openEditors.sortOrder')) { this.sortOrder = this.configurationService.getValue('explorer.openEditors.sortOrder'); <del> this.listRefreshScheduler.schedule(); </del> <ins> this.listRefreshScheduler?.schedule(); </ins> } }