@@ -236,7 +236,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
236236 this . _register ( this . viewsRegistry . onViewsRegistered ( ( { views, viewContainer } ) => this . onDidRegisterViews ( views , viewContainer ) ) ) ;
237237 this . _register ( this . viewsRegistry . onViewsDeregistered ( ( { views, viewContainer } ) => this . onDidDeregisterViews ( views , viewContainer ) ) ) ;
238238
239- this . _register ( this . viewsRegistry . onDidChangeContainer ( ( { views, from, to } ) => { this . removeViews ( from , views ) ; this . addViews ( to , views ) ; this . _onDidChangeContainer . fire ( { views , from, to } ) ; } ) ) ;
239+ this . _register ( this . viewsRegistry . onDidChangeContainer ( ( { views, from, to } ) => this . moveViews ( views , from , to ) ) ) ;
240240
241241 this . _register ( this . viewContainersRegistry . onDidRegister ( ( { viewContainer } ) => this . onDidRegisterViewContainer ( viewContainer ) ) ) ;
242242 this . _register ( this . viewContainersRegistry . onDidDeregister ( ( { viewContainer } ) => this . onDidDeregisterViewContainer ( viewContainer ) ) ) ;
@@ -405,19 +405,23 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
405405 const to = viewContainer ;
406406
407407 if ( from && to && from !== to ) {
408- this . removeViews ( from , views ) ;
409- this . addViews ( to , views ) ;
408+ this . moveViews ( views , from , to ) ;
409+ }
410+ }
410411
411- const oldLocation = this . viewContainersRegistry . getViewContainerLocation ( from ) ! ;
412- const newLocation = this . viewContainersRegistry . getViewContainerLocation ( to ) ! ;
412+ private moveViews ( views : IViewDescriptor [ ] , from : ViewContainer , to : ViewContainer ) : void {
413+ this . removeViews ( from , views ) ;
414+ this . addViews ( to , views ) ;
413415
414- if ( oldLocation !== newLocation ) {
415- this . _onDidChangeLocation . fire ( { views, from : oldLocation , to : newLocation } ) ;
416- }
416+ const oldLocation = this . viewContainersRegistry . getViewContainerLocation ( from ) ! ;
417+ const newLocation = this . viewContainersRegistry . getViewContainerLocation ( to ) ! ;
417418
418- this . _onDidChangeContainer . fire ( { views , from , to } ) ;
419- this . saveViewPositionsToCache ( ) ;
419+ if ( oldLocation !== newLocation ) {
420+ this . _onDidChangeLocation . fire ( { views , from : oldLocation , to : newLocation } ) ;
420421 }
422+
423+ this . _onDidChangeContainer . fire ( { views, from, to } ) ;
424+ this . saveViewPositionsToCache ( ) ;
421425 }
422426
423427 private registerViewContainerForSingleView ( sourceView : IViewDescriptor , location : ViewContainerLocation ) : ViewContainer {
0 commit comments