anshumanv / evolutions-webapp

What? monferno is evolving!
https://evolutions.js.org
MIT License
17 stars 17 forks source link

Improve performance of search by ID (num) #46

Closed dericcain closed 5 years ago

dericcain commented 6 years ago

In order to gain better performance when searching by ID, we are creating a lookup table that contains the num->name when the component is instantiated. If an ID is used to search, then we reference our lookup table and return the results. This should be a really fast solution since we are performing all of the efforts up front.

Closes #20

By submitting this pull request I confirm I've read and complied with the below declarations.

anshumanv commented 6 years ago

Hey @dericgw really thanks for this! Can you please resolve the merge conflicts? :smile:

dericcain commented 6 years ago

@anshumanv I ended up having to completely refactor the "Search" because all of the logic that once lived in the component was moved to the helpers file. Now, you have a nice, clean search class that handles everything pertaining to search. And, the lookup speeds things up when searching by ID.

It looks like a test was broken in a previous commit which was merged without a PR (that is why there are no other failed CI tests). I would imagine that this happened when react-autocomplete was introduced because that specific test is looking for a direct child as an input an react-autocomplete seems to wrap the input in a div.