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

Refactoring the quries into a single one to get the search results on Home Page #4372

Merged

Conversation

Ankit-Keshari-Vituity
Copy link
Contributor

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@github-actions
Copy link

github-actions bot commented Mar 10, 2022

Unit Test Results (build & test)

  92 files  +16    92 suites  +16   14m 7s ⏱️ - 9m 3s
672 tests +48  613 ✔️ +49  59 💤 ±0  0  - 1 
672 runs  +47  613 ✔️ +49  59 💤 ±0  0  - 2 

Results for commit 6bc385f. ± Comparison against base commit d474387.

♻️ This comment has been updated with latest results.

});
const searchResultsToShow = useMemo(() => {
let result: string[] | undefined = [];
if (!searchResultsLoading) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also just say...

if (searchResultsData) {

....

}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also simplify the dependencies required for the useMemo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and Commited

@@ -232,11 +206,11 @@ export const HomePageHeader = () => {
autoCompleteStyle={styles.searchBox}
entityRegistry={entityRegistry}
/>
{suggestionsToShow && suggestionsToShow.length > 0 && (
{searchResultsToShow && searchResultsToShow.length > 0 && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: we can simplify to

searchResultsToShow?.length > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As We are using

let result: string[] | undefined = [];

That's why added check searchResultsToShow && searchResultsToShow.length > 0.

@shirshanka shirshanka merged commit 5535778 into datahub-project:master Mar 15, 2022
maggiehays pushed a commit to maggiehays/datahub that referenced this pull request Aug 1, 2022
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.

3 participants