fecgov / fecfile-web-app

Other
7 stars 4 forks source link

Remove method calls from component templates for ngIf and ngSwitch #2108

Closed exalate-issue-sync[bot] closed 1 month ago

exalate-issue-sync[bot] commented 2 months ago

We have a few ngIf and ngSwitch statements that call methods rather than looking at variables. This can degrade performance as the change detection can run the method many times.

https://medium.com/showpad-engineering/why-you-should-never-use-function-calls-in-angular-template-expressions-e1a50f9c0496

https://www.angulartraining.com/daily-newsletter/anti-pattern-series-calling-a-method-in-a-template/

The task is to find the ngSwitch and ngIf statements in templates that call methods and replace the method with variables set in ngOnInit()

QA Notes

Ticket passes if unit tests and e2e tests pass. No changes to UI.

DEV Notes

2 examples of this issue:

[https://github.com/fecgov/fecfile-web-app/blob/release/sprint-46/front-end/src/app/reports/transactions/transaction-container/transaction-container.component.html#L4|https://github.com/fecgov/fecfile-web-app/blob/release/sprint-46/front-end/src/app/reports/transactions/transaction-container/transaction-container.component.html#L4|smart-link]

[https://github.com/fecgov/fecfile-web-app/blob/release/sprint-46/front-end/src/app/reports/f3x/create-workflow/create-f3x-step1.component.html#L88|https://github.com/fecgov/fecfile-web-app/blob/release/sprint-46/front-end/src/app/reports/f3x/create-workflow/create-f3x-step1.component.html#L88|smart-link]

Design

null

See full ticket and images here: FECFILE-1526

exalate-issue-sync[bot] commented 2 months ago

From CR, [~accountid:712020:005cf740-faa3-4d67-baff-f316981bdc9f] Please double-check that the e2e tests are passing for this ticket.

Moving ticket back to In Progress

exalate-issue-sync[bot] commented 2 months ago

[~accountid:557058:3e765e5c-5614-4ef8-975a-6f5202ed75a9] now that I merged develop into 1526 branch, e2e tests are passing [https://app.circleci.com/pipelines/github/fecgov/fecfile-web-app/6398/workflows/af53f54f-8ccd-40eb-afa4-a08cca271f8a/jobs/21934|https://app.circleci.com/pipelines/github/fecgov/fecfile-web-app/6398/workflows/af53f54f-8ccd-40eb-afa4-a08cca271f8a/jobs/21934]

exalate-issue-sync[bot] commented 1 month ago

Todd Lees commented: E2E tests passing [https://app.circleci.com/pipelines/github/fecgov/fecfile-web-app/6398/workflows/af53f54f-8ccd-40eb-afa4-a08cca271f8a/jobs/21934|https://app.circleci.com/pipelines/github/fecgov/fecfile-web-app/6398/workflows/af53f54f-8ccd-40eb-afa4-a08cca271f8a/jobs/21934]

!image-20240911-130638.png|width=1621,height=592,alt="image-20240911-130638.png"!

exalate-issue-sync[bot] commented 1 month ago

Todd Lees commented: passes cr moving to QA

exalate-issue-sync[bot] commented 1 month ago

Shelly Wise commented: QA Review verified e2e tests passing per DEV.

QA Review Completed. Moved to Stage Ready.

exalate-issue-sync[bot] commented 1 month ago

Automation for Jira commented: Sprint accepted by Paul Clark at Sprint Review on comment date.