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

fix(glossary) Improve performance when getting root glossary terms #6214

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useEffect } from 'react';
import styled from 'styled-components/macro';
import { useGetRootGlossaryNodesQuery, useGetRootGlossaryTermsQuery } from '../../../graphql/glossary.generated';
import { GlossaryNode, GlossaryTerm } from '../../../types.generated';
import { ChildGlossaryTermFragment } from '../../../graphql/glossaryNode.generated';
import { GlossaryNode } from '../../../types.generated';
import { sortGlossaryNodes } from '../../entity/glossaryNode/utils';
import { sortGlossaryTerms } from '../../entity/glossaryTerm/utils';
import { useEntityRegistry } from '../../useEntityRegistry';
Expand All @@ -18,7 +19,7 @@ const BrowserWrapper = styled.div`

interface Props {
rootNodes?: GlossaryNode[];
rootTerms?: GlossaryTerm[];
rootTerms?: ChildGlossaryTermFragment[];
isSelecting?: boolean;
hideTerms?: boolean;
openToEntity?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';
import styled from 'styled-components/macro';
import { Link } from 'react-router-dom';
import { useEntityData } from '../../entity/shared/EntityContext';
import { GlossaryTerm } from '../../../types.generated';
import { useEntityRegistry } from '../../useEntityRegistry';
import { ANTD_GRAY } from '../../entity/shared/constants';
import { ChildGlossaryTermFragment } from '../../../graphql/glossaryNode.generated';

const TermWrapper = styled.div`
font-weight: normal;
Expand Down Expand Up @@ -44,7 +44,7 @@ export const NameWrapper = styled.span<{ showSelectStyles?: boolean }>`
`;

interface Props {
term: GlossaryTerm;
term: ChildGlossaryTermFragment;
isSelecting?: boolean;
selectTerm?: (urn: string, displayName: string) => void;
}
Expand Down
3 changes: 2 additions & 1 deletion datahub-web-react/src/app/glossary/GlossaryEntitiesList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import styled from 'styled-components/macro';
import { GlossaryNodeFragment } from '../../graphql/fragments.generated';
import { ChildGlossaryTermFragment } from '../../graphql/glossaryNode.generated';
import { GlossaryNode, GlossaryTerm } from '../../types.generated';
import { useEntityRegistry } from '../useEntityRegistry';
import GlossaryEntityItem from './GlossaryEntityItem';
Expand All @@ -13,7 +14,7 @@ const EntitiesWrapper = styled.div`

interface Props {
nodes: (GlossaryNode | GlossaryNodeFragment)[];
terms: GlossaryTerm[];
terms: (GlossaryTerm | ChildGlossaryTermFragment)[];
}

function GlossaryEntitiesList(props: Props) {
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/graphql/glossary.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ query getRootGlossaryTerms {
start
total
terms {
...glossaryTerm
...childGlossaryTerm
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions datahub-web-react/src/graphql/glossaryNode.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fragment childGlossaryTerm on GlossaryTerm {
urn
type
name
hierarchicalName
properties {
Expand Down