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

refactor(ui): Loading schema dynamically for dataset profile #7558

Merged

Conversation

jjoyce0510
Copy link
Collaborator

Summary

We've found that large schemas can bottleneck the time to first meaningful render on the Dataset profile page. This PR speeds things up by separating the schema tab load from the main getDataset query (for datasets only).

Features include a new loading indicator on the schema tab while the fetch for the schema loads. We also use the apollo cache to ensure that switching between tabs remains smooth.

Status

Ready for review.

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 Mar 13, 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.

nice! two quick questions then let's do this

});
const isHideSiblingMode = useIsSeparateSiblingsMode();
// Merge with sibling information as required.
const combinedData = rawData && !isHideSiblingMode ? combineEntityDataWithSiblings(cloneDeep(rawData)) : rawData;
Copy link
Collaborator

Choose a reason for hiding this comment

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

does the cloneDeep here just ensure we don't mess with the original rawData object in this method? is that necessary in the other places we call combineEntityDataWithSiblings or only here because it's cache-first?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's because of cache! apollo hates it when we f with the objects it has in cache!

urn,
},
skip: entityType !== EntityType.Dataset,
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.

is editing schema field documentation, tags, and terms affected here with cache-first?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i've actually updated to address!

export const useGetEntityWithSchema = () => {
const { urn, entityData, entityType } = useEntityData();
// Load the dataset schema lazily.
const { data: rawData, loading } = useGetDatasetSchemaQuery({
Copy link
Collaborator

Choose a reason for hiding this comment

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

also i think this query got lost in the commit so it's not defined? or is it already defined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it should be inside dataset.graphql!

@vercel
Copy link

vercel bot commented Mar 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
docs-website ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 21, 2023 at 10:07PM (UTC)

@jjoyce0510 jjoyce0510 merged commit ce33db7 into datahub-project:master Mar 22, 2023
shirshanka pushed a commit to shirshanka/datahub that referenced this pull request Mar 22, 2023
…-project#7558)

Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com>
shirshanka pushed a commit to shirshanka/datahub that referenced this pull request Mar 22, 2023
…-project#7558)

Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com>
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

3 participants