Skip to content

Commit 318da93

Browse files
authored
fix: embedded sample scenario is not loading (#239)
* fix: embedded sample scenario is not loading * fix: multiple pyHome calls happening
1 parent 0d0559c commit 318da93

File tree

7 files changed

+31
-32
lines changed

7 files changed

+31
-32
lines changed

packages/angular-sdk-components/src/lib/_components/infra/Containers/flow-container/flow-container.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
104104

105105
this.initContainer();
106106

107+
this.checkAndUpdate();
108+
107109
PCore.getPubSubUtils().subscribe(
108110
PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL,
109111
() => {
@@ -595,7 +597,6 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
595597
});
596598
}
597599

598-
// eslint-disable-next-line sonarjs/no-identical-functions
599600
topViewRefresh(): void {
600601
Object.values(this.formGroup$.controls).forEach(control => {
601602
control.markAsTouched();

packages/angular-sdk-components/src/lib/_components/infra/Containers/view-container/view-container.component.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,22 @@ export class ViewContainerComponent implements OnInit, OnDestroy {
9999
dispatchObject: this.dispatchObject,
100100
visible: !PCore.checkIfSemanticURL()
101101
};
102-
containerMgr.initializeContainers({
103-
type: mode === CONTAINER_TYPE.MULTIPLE ? CONTAINER_TYPE.MULTIPLE : CONTAINER_TYPE.SINGLE
104-
});
105102

106-
if (mode === CONTAINER_TYPE.MULTIPLE && limit) {
107-
/* NOTE: setContainerLimit use is temporary. It is a non-public, unsupported API. */
108-
PCore.getContainerUtils().setContainerLimit(`${APP.APP}/${name}`, limit);
109-
}
103+
if (sessionStorage.getItem('hasViewContainer') == 'false') {
104+
containerMgr.initializeContainers({
105+
type: mode === CONTAINER_TYPE.MULTIPLE ? CONTAINER_TYPE.MULTIPLE : CONTAINER_TYPE.SINGLE
106+
});
107+
108+
if (mode === CONTAINER_TYPE.MULTIPLE && limit) {
109+
/* NOTE: setContainerLimit use is temporary. It is a non-public, unsupported API. */
110+
PCore.getContainerUtils().setContainerLimit(`${APP.APP}/${name}`, limit);
111+
}
110112

111-
if (!PCore.checkIfSemanticURL()) containerMgr.addContainerItem(this.pConn$ as any);
112-
if (!this.displayOnlyFA$) configureBrowserBookmark(this.pConn$);
113+
if (!PCore.checkIfSemanticURL()) containerMgr.addContainerItem(this.pConn$ as any);
114+
if (!this.displayOnlyFA$) configureBrowserBookmark(this.pConn$);
115+
116+
sessionStorage.setItem('hasViewContainer', 'true');
117+
}
113118

114119
// cannot call checkAndUpdate becasue first time through, will call updateSelf and that is incorrect (causes issues).
115120
// however, need angularPConnect to be initialized with currentProps for future updates, so calling shouldComponentUpdate directly

packages/angular-sdk-components/src/lib/_components/infra/root-container/root-container.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ export class RootContainerComponent implements OnInit, OnDestroy {
9797
}
9898
});
9999

100+
// clear out hasViewContainer
101+
sessionStorage.setItem('hasViewContainer', 'false');
102+
100103
this.mConn$ = configObjModal.getPConnect();
101104

102105
// First thing in initialization is registering and subscribing to the AngularPConnect service

packages/angular-sdk-components/src/lib/_components/infra/view/view.component.html

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,12 @@
1414
</ng-container>
1515

1616
<ng-template #noTemplate>
17-
<div *ngIf="displayOnlyFA$; else displayAll">
18-
<div *ngFor="let kid of arChildren$">
19-
<div [ngSwitch]="kid.getPConnect().getComponentName()">
20-
<component-mapper
21-
[name]="kid.getPConnect().getComponentName()"
22-
[props]="{ pConn$: kid.getPConnect() }"
23-
errorMsg="View Missing (displayOnlyFA): {{ kid.getPConnect().getComponentName() }}"
24-
></component-mapper>
25-
</div>
26-
</div>
17+
<div *ngFor="let kid of arChildren$">
18+
<component-mapper
19+
[name]="kid.getPConnect().getComponentName()"
20+
[props]="{ pConn$: kid.getPConnect() }"
21+
errorMsg="View Missing (displayAll): {{ kid.getPConnect().getComponentName() }}"
22+
></component-mapper>
2723
</div>
28-
<ng-template #displayAll>
29-
<div *ngFor="let kid of arChildren$">
30-
<component-mapper
31-
[name]="kid.getPConnect().getComponentName()"
32-
[props]="{ pConn$: kid.getPConnect() }"
33-
errorMsg="View Missing (displayAll): {{ kid.getPConnect().getComponentName() }}"
34-
></component-mapper>
35-
</div>
36-
</ng-template>
3724
</ng-template>
3825
</div>

packages/angular-sdk-components/src/lib/_components/template/default-form/default-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, Input, forwardRef } from '@angular/core';
1+
import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormGroup } from '@angular/forms';
44
import { ReferenceComponent } from '../../infra/reference/reference.component';
@@ -19,7 +19,7 @@ interface DefaultFormProps {
1919
standalone: true,
2020
imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
2121
})
22-
export class DefaultFormComponent implements OnInit {
22+
export class DefaultFormComponent implements OnInit, OnDestroy {
2323
@Input() pConn$: typeof PConnect;
2424
@Input() formGroup$: FormGroup;
2525

packages/angular-sdk-components/src/lib/_components/template/page/page.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export class PageComponent implements OnInit, OnDestroy {
4242
if (operator && operator != '') {
4343
this.title$ += `, ${operator}`;
4444
}
45+
46+
// when showing a page, similar to updating root, need to cause viewContainer to call "initContainer"
47+
sessionStorage.setItem('hasViewContainer', 'false');
4548
}
4649

4750
ngOnDestroy(): void {

projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
}
6161

6262
.mc-info-image {
63-
width: 700px;
63+
width: calc(100% - 40px);
6464
margin: 20px;
6565
border-radius: 10px;
6666
}

0 commit comments

Comments
 (0)