-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
vishalshrm539
commented
Sep 27, 2023
- Fixed the angular errors seen as mentioned in BUG-827920.
- Did some cleanup.
@@ -17,6 +17,15 @@ export class ComponentMapperComponent implements OnInit, OnChanges { | |||
public componentRef: ComponentRef<any> | undefined; | |||
public isInitialized: boolean = false; | |||
|
|||
private componentsRequireDisplayOnlyFAProp: Array<string> = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have this array as a constant value outside component, not as a component property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that can be done.
// Eventual plan is to get rid of this particular prop | ||
if(propName !== "displayOnlyFA$" || (propName === "displayOnlyFA$" && this.componentsRequireDisplayOnlyFAProp.includes(this.name))){ | ||
this.componentRef.setInput(propName, this.props[propName]); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
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]); | |
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
395a106
to
9822996
Compare