@@ -31,7 +31,7 @@ import { BuildContext, Project, TargetSetData } from './components-data';
3131import { ComponentsPacksActions , CurrentProject , normalizeForCompare } from './components-packs-actions' ;
3232import { ComponentRowDataType , ComponentScope } from './data/component-tools' ;
3333import { componentTreeWalker } from './data/component-tree-walker' ;
34- import { uniqWith } from 'lodash' ;
34+ import { uniqWith , cloneDeep } from 'lodash' ;
3535import { parsePackId } from './data/pack-parse' ;
3636import { lineOf , readTextFile } from '../../utils/fs-utils' ;
3737import { stripTwoExtensions } from '../../utils/string-utils' ;
@@ -420,11 +420,12 @@ export class ComponentsPacksWebviewMain {
420420 const activeContext = this . getActiveContext ( ) ;
421421 const state = await this . csolutionService . apply ( { context : activeContext } ) ;
422422 this . usedItems = await this . csolutionService . getUsedItems ( { context : activeContext } ) ;
423+ const usedItemsForProjectFileUpdate = cloneDeep ( this . usedItems ) ;
423424 const projectFileName = this . currentProject ?. project . projectId ?? '' ;
424425 const requestAll = this . scope === ComponentScope . All ;
425426 this . componentTree = this . manageComponentsActions . mapComponentsFromService ( await this . csolutionService . getComponentsTree ( { context : activeContext , all : requestAll } ) ) ;
426427 this . validations = await this . csolutionService . validateComponents ( { context : activeContext } ) ;
427- await this . projectFileUpdater . updateUsedItems ( activeContext , projectFileName , this . usedItems ) ;
428+ await this . projectFileUpdater . updateUsedItems ( activeContext , projectFileName , usedItemsForProjectFileUpdate ) ;
428429
429430 await Promise . all ( [
430431 this . webviewManager . sendMessage ( { type : 'SET_ERROR_MESSAGES' , messages : [ ] } ) ,
@@ -433,7 +434,7 @@ export class ComponentsPacksWebviewMain {
433434 if ( state . success === false ) {
434435 this . webviewManager . sendMessage ( { type : 'SET_SOLUTION_STATE' , stateMessage : state . message ?? 'Unspecified error when writing solution information' } ) ;
435436 }
436- await this . sendDirtyState ( { skipApply : true , usedItems : this . usedItems } ) ;
437+ await this . sendDirtyState ( { skipApply : true , usedItems : usedItemsForProjectFileUpdate } ) ;
437438 }
438439
439440 private async handleOpenFile ( message : Messages . OutgoingMessage ) : Promise < void > {
0 commit comments