fecgov / fecfile-web-app

7 stars 4 forks source link

SPIKE: investigate why "/contacts/get_contact_id/" runs numerous times on committee lookup #2091

Closed exalate-issue-sync[bot] closed 2 days ago

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

When investigating external connections from FECFile Online, Laura noticed that the contacts/get_contact_id/ ran numerous times on committee lookup when creating a new committee contact. This might be because of the type-ahead functionality. The purpose of this ticket is to:

  1. Determine why /contacts/get_contact_id/ runs multiple times
  2. Determine if we can and should streamline it
  3. Identify solution (bug or defect), Work with Shelly on scope of solution, and create a ticket for it.

example of requests (to produce this there was no typing in the search bar, so i’s likely not related to the typeahead):

[!Untitled.png!| /attachments/11590?name=Untitled.png]

TIMEBIOX to 4 hours

QA Notes

null

DEV Notes

Potential solutions can include running the lookup every few characters with the type-ahead functionality, or debouncing

Design

null

See full ticket and images here: FECFILE-1507

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

Sasha Dresden commented: I dug into this code and it’s due to the way asynchronous validation is being handled for the committee_fec_id field. It’s essentially getting triggered multiple times due to the way angular form updates are handled. However, there is a simple fix! You tell it to only run when value changes are explicitly provided. Essentially, telling it to only run when the form is dirty, which would not be the case when it is simply being populated.

In the ContactService.getFecIdValidator() function, you can add the following to the top of the returned function

{noformat}if (!control.dirty) {     return of(null); }{noformat}

I tested this locally and it prevented the large spike of requests that happen when the form gets populated via committee selection/creation, but still allows the validator to run when you manually attempt to change the value after the fact.

exalate-issue-sync[bot] commented 4 weeks ago

There are not code changes for this ticket so sending straight to QA. A follow on ticket was created for the actual work: [https://fecgov.atlassian.net/browse/FECFILE-1523|https://fecgov.atlassian.net/browse/FECFILE-1523|smart-link]

exalate-issue-sync[bot] commented 3 weeks ago

There are no code changes for this SPIKE.

Not reviewed by QA. Moved to Stage Ready.

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

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