@@ -461,29 +461,23 @@ define(function (require, exports, module) {
461461 EditorManager . on ( "activeEditorChange" , updateTabs ) ;
462462
463463 // For working set changes, update only the tabs.
464- MainViewManager . off ( "workingSetAdd" , updateTabs ) ;
465- MainViewManager . on ( "workingSetAdd" , updateTabs ) ;
466-
467- MainViewManager . off ( "workingSetRemove" , updateTabs ) ;
468- MainViewManager . on ( "workingSetRemove" , updateTabs ) ;
469-
470- MainViewManager . off ( "workingSetSort" , updateTabs ) ;
471- MainViewManager . on ( "workingSetSort" , updateTabs ) ;
472-
473- MainViewManager . off ( "workingSetMove" , updateTabs ) ;
474- MainViewManager . on ( "workingSetMove" , updateTabs ) ;
475-
476- MainViewManager . off ( "workingSetAddList" , updateTabs ) ;
477- MainViewManager . on ( "workingSetAddList" , updateTabs ) ;
478-
479- MainViewManager . off ( "workingSetRemoveList" , updateTabs ) ;
480- MainViewManager . on ( "workingSetRemoveList" , updateTabs ) ;
481-
482- MainViewManager . off ( "workingSetUpdate" , updateTabs ) ;
483- MainViewManager . on ( "workingSetUpdate" , updateTabs ) ;
484-
485- MainViewManager . off ( "_workingSetDisableAutoSort" , updateTabs ) ;
486- MainViewManager . on ( "_workingSetDisableAutoSort" , updateTabs ) ;
464+ const events = [
465+ "workingSetAdd" ,
466+ "workingSetRemove" ,
467+ "workingSetSort" ,
468+ "workingSetMove" ,
469+ "workingSetAddList" ,
470+ "workingSetRemoveList" ,
471+ "workingSetUpdate" ,
472+ "_workingSetDisableAutoSort"
473+ ] ;
474+ MainViewManager . off ( events . join ( " " ) , updateTabs ) ;
475+ MainViewManager . on ( events . join ( " " ) , updateTabs ) ;
476+
477+ // When the sidebar UI changes, update the tabs to ensure the overflow menu is correct.
478+ // Without this, if the sidebar is hidden, and **all tabs become visible**, the overflow icon still appears.
479+ $ ( "#sidebar" ) . off ( "panelCollapsed panelExpanded panelResizeEnd" , updateTabs ) ;
480+ $ ( "#sidebar" ) . on ( "panelCollapsed panelExpanded panelResizeEnd" , updateTabs ) ;
487481
488482 // file dirty flag change remains unchanged.
489483 DocumentManager . on ( "dirtyFlagChange" , function ( event , doc ) {
0 commit comments