Skip to content

Commit

Permalink
fix(glossary) Improve performance when getting root glossary terms
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Collins authored and Chris Collins committed Oct 17, 2022
1 parent 034f2e9 commit 0bb4ff6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
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

0 comments on commit 0bb4ff6

Please sign in to comment.