-
Notifications
You must be signed in to change notification settings - Fork 15
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(frontend/controller): improve match highlighting + split up the search component #594
Conversation
Now I have moved all the result related things to Result component. We pass down necessary props to Result component and it will take care of mapping through and highlighting of each search result. It is a first step towards simplifying the search component so that we can start working on #511. |
@Harjot1Singh I need help, I messed up highlighting of a search results when keyboard keys are pressed to select an item. |
Split search component so that results are their own component
this allows to use variables in scope rather than having to pass them down
69598cf
to
3b03075
Compare
3bfc71e
to
ea1bea5
Compare
Refactors Results into single result component
ea1bea5
to
cb24bfc
Compare
Co-authored-by: Saihajpreet Singh <[email protected]>
Co-authored-by: Saihajpreet Singh <[email protected]>
Co-authored-by: Saihajpreet Singh <[email protected]>
This serves as a very good basis and the preliminary work required by #221, which will serve as one of our biggest performance improvements. |
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.
Great work! Would have liked a little more narrative with comments. Working fine with tests of wildcard characters, full words, and all options in search (translit/translation/citation, etc.). LGTM!
cfa0b19
to
2edeacc
Compare
Summary of PR
The Results function was very huge and it was getting quite confusing to navigate around. Idea here is to split up the search component so that results becomes its own component and all highlighting is contained there. Search component will pass down all the necessary props.
I tried bringing context down to results (where it makes way much more sense and then we don't have to pass so many things down) but was not possible because it breaks react hooks rules. Later I realized it is also not so great because we are mapping though the list of results we get from backend and that might be too much work each time to get context from the hook.
@Harjot1Singh you probably have some better way because this has reached very high levels of prop drilling.
Fixes
Fixes #567
Fixes #569
TTR
@saihaj - unsure
@Harjot1Singh - 2 hours