Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Angular errors #63

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import { CommonModule } from '@angular/common';
import { SdkComponentMap } from '../helpers/sdk_component_map';
import { ErrorBoundaryComponent } from '../../_components/infra/error-boundary/error-boundary.component';


const componentsRequireDisplayOnlyFAProp: Array<string> = [
"HybridViewContainer",
"ModalViewContainer",
"ViewContainer",
"RootContainer",
"View",
"CaseView"
];

@Component({
selector: 'component-mapper',
templateUrl: './component-mapper.component.html',
Expand Down Expand Up @@ -84,6 +94,12 @@ export class ComponentMapperComponent implements OnInit, OnChanges {
try {
for (const propName in this.props) {
if (this.props[propName] !== undefined) {
// We'll set 'displayOnlyFA$' prop only to the components which really need it
// Eventual plan is to get rid of this particular prop
if(propName === "displayOnlyFA$" && !componentsRequireDisplayOnlyFAProp.includes(this.name)){
// eslint-disable-next-line no-continue
continue;
}
this.componentRef.setInput(propName, this.props[propName]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
if (this.props[propName] !== undefined) {
// We'll set 'displayOnlyFA$' prop only to the components which really need it
// Eventual plan is to get rid of this particular prop
if(propName === "displayOnlyFA$" && this.componentsRequireDisplayOnlyFAProp.includes(this.name)){
continue;
}
this.componentRef.setInput(propName, this.props[propName]);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work , I think you forgot to add "!" in the if check. Anyways, the existing condition looks ok and more readable, no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I forgot to add ! before includes condition
if(propName === "displayOnlyFA$" && !this.componentsRequireDisplayOnlyFAProp.includes(this.name))

This way you will have separate logic for skipping property binding

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Component, OnInit, Input } from '@angular/core';
})
export class ReferenceComponent implements OnInit {
@Input() pConn$: any;
@Input() displayOnlyFA$: boolean;

configProps$: Object;
referencedComponent: any = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ComponentMapperComponent } from '../../../_bridge/component-mapper/comp
export class WideNarrowPageComponent implements OnInit {
@Input() pConn$: any;
@Input() formGroup$: FormGroup;
@Input() displayOnlyFA$;

thePConnType: string = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
</div>

<div *ngIf="sComponentName$ == 'RootContainer'">
<component-mapper name="RootContainer" [props]="{ pConn$, PCore$, props$, displayOnlyFA: false }"></component-mapper>
<component-mapper name="RootContainer" [props]="{ pConn$, PCore$, props$, displayOnlyFA$: false }"></component-mapper>
</div>
Loading