Skip to content

Commit

Permalink
fix missing leaf CREs
Browse files Browse the repository at this point in the history
  • Loading branch information
dlicheva committed Jun 23, 2024
1 parent 70c1641 commit d1ef005
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions application/frontend/src/pages/Explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { TYPE_CONTAINS, TYPE_LINKED_TO } from '../../const';
import { useDataStore } from '../../providers/DataProvider';
import { LinkedTreeDocument, TreeDocument } from '../../types';
import { LinkedStandards } from './LinkedStandards';
import { getDocumentDisplayName } from '../../utils';
import { getInternalUrl } from '../../utils/document';

export const Explorer = () => {
const { dataLoading, dataTree } = useDataStore();
Expand Down Expand Up @@ -80,6 +82,10 @@ export const Explorer = () => {
if (!item) {
return <></>;
}
item.displayName = item.displayName ?? getDocumentDisplayName(item);
item.url = item.url ?? getInternalUrl(item);
item.links = item.links ?? [];

const contains = item.links.filter((x) => x.ltype === TYPE_CONTAINS);
const linkedTo = item.links.filter((x) => x.ltype === TYPE_LINKED_TO);

Expand Down
4 changes: 3 additions & 1 deletion application/frontend/src/providers/DataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const DataProvider = ({ children }: { children: React.ReactNode }) => {
);

if (!creLinks.length) {
storedDoc.links = [];
// leaves of the tree can be links that are included in the keyPath.
// If we don't add this here, the leaves are filtered out above (see ticket #514 on OpenCRE)
storedDoc.links = initialLinks.filter((x) => x.ltype === 'Contains' && !!x.document);
return storedDoc;
}

Expand Down

0 comments on commit d1ef005

Please sign in to comment.