Skip to content

Commit 7a46635

Browse files
committed
Fix project loading logic and reorder component tree updates in ComponentsPacksWebviewMain
1 parent 3873534 commit 7a46635

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/views/manage-components-packs/components-packs-webview-main.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ export class ComponentsPacksWebviewMain {
131131
return; // nothing to show
132132
}
133133

134+
const reload = this.projectFromPath(this.currentProject?.project.projectId) !== this.projectFromPath(cprojectPath);
135+
const csolution = this.solutionManager.getCsolution();
136+
if (csolution) {
137+
this.currentProject = { solutionPath: csolution.solutionPath, project: createProject(cprojectPath) };
138+
}
139+
134140
if (clayerPath) {
135141
const selectedTarget = this.findTargetSetFromPath(clayerPath);
136142
if (selectedTarget) {
@@ -141,7 +147,6 @@ export class ComponentsPacksWebviewMain {
141147
}
142148
this.webviewManager.createOrShowPanel();
143149

144-
const reload = this.projectFromPath(this.currentProject?.project.projectId) !== this.projectFromPath(cprojectPath);
145150
await this.debounce_load(cprojectPath, reload);
146151
await this.sendDirtyState();
147152
}
@@ -658,14 +663,14 @@ export class ComponentsPacksWebviewMain {
658663
const activeContext = this.getActiveContext();
659664
const requestAll = this.scope === ComponentScope.All;
660665

661-
this.componentTree = this.manageComponentsActions.mapComponentsFromService(await this.csolutionService.getComponentsTree({ context: activeContext, all: requestAll }));
662-
this.validations = await this.csolutionService.validateComponents({ context: activeContext });
663-
const packsInfo = this.mapPacksFromService(await this.csolutionService.getPacksInfo({ context: activeContext, all: requestAll }));
664-
665666
if (!this.availablePacksCache || Object.keys(this.availablePacksCache).length === 0) {
666667
this.availablePacksCache = await this.filterAvailablePacks(activeContext);
667668
}
668669

670+
this.componentTree = this.manageComponentsActions.mapComponentsFromService(await this.csolutionService.getComponentsTree({ context: activeContext, all: requestAll }));
671+
this.validations = await this.csolutionService.validateComponents({ context: activeContext });
672+
const packsInfo = this.mapPacksFromService(await this.csolutionService.getPacksInfo({ context: activeContext, all: requestAll }));
673+
669674
componentTreeWalker(this.componentTree, (node, type) => {
670675
if (type === 'aggregate' && (node as CtAggregate).options?.layer) {
671676
(node as CtAggregate).options!.layer = (node as CtAggregate).options!.layer || '';

0 commit comments

Comments
 (0)