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

feat(ui): Add caching to search, entity profile for better UX #9362

Conversation

jjoyce0510
Copy link
Collaborator

@jjoyce0510 jjoyce0510 commented Nov 30, 2023

Summary

  • Adding caching for search page
  • Adding caching for entity profile page
  • Adding caching to embedded list search components
  • Adding skeleton loader for search results page

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). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Nov 30, 2023
Copy link
Collaborator

@chriscollins3456 chriscollins3456 left a comment

Choose a reason for hiding this comment

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

this is so exciting. the app is gonna feel so nice after this

@@ -88,6 +91,7 @@ export default function BasicFilters({
<span id={SEARCH_RESULTS_FILTERS_ID}>
<FlexSpacer>
<FlexWrapper>
{loading && !visibleFilters?.length && <BasicFiltersLoadingSection />}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@@ -188,6 +188,7 @@ export const EmbeddedListSearch = ({
variables: {
input: searchInput,
},
fetchPolicy: 'cache-first',
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh man what a time to be alive - these possibleTypes making search caching possible!

@@ -32,6 +32,7 @@ export default function useGetDataForProfile<T>({ urn, entityType, useEntityQuer
refetch,
} = useEntityQuery({
variables: { urn },
fetchPolicy: 'cache-first',
Copy link
Collaborator

Choose a reason for hiding this comment

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

and this won't prevent showing updates when we add tags, terms, domains, documentation etc?

Copy link
Collaborator

Choose a reason for hiding this comment

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

testing locally things look alright to me... but never hurts to double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thats right -- generally we issue a refetch on changes and that will always trigger a network call!

@@ -62,6 +62,7 @@ export const SearchPage = () => {
searchFlags: { getSuggestions: true },
},
},
fetchPolicy: 'cache-and-network',
Copy link
Collaborator

Choose a reason for hiding this comment

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

sweet so this will show cached results first and then once the network request returns it will update that cache and show updated results?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes! So if you change tags, owners, etc and return to search page we will indeed get the update for the user

@jjoyce0510
Copy link
Collaborator Author

unrelated tests failing.. merging!

@jjoyce0510 jjoyce0510 merged commit f3abfd1 into datahub-project:master Dec 1, 2023
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants