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

Fix Angular errors #63

merged 2 commits into from
Sep 29, 2023

Conversation

vishalshrm539
Copy link
Contributor

  • 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> = [
Copy link
Collaborator

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

Copy link
Contributor Author

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]);
}
}
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

@vishalshrm539 vishalshrm539 merged commit baa380e into master Sep 29, 2023
2 checks passed
tumms2021389 added a commit that referenced this pull request Oct 4, 2023
@tumms2021389 tumms2021389 deleted the bug/tor/BUG-827920 branch October 4, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants