Skip to content

Commit

Permalink
Bugfix/514 🐛 Fix explorer incomplete (#518)
Browse files Browse the repository at this point in the history
* remove unnecessary console.log

* fix missing leaf CREs
  • Loading branch information
dlicheva authored Jun 24, 2024
1 parent fc8cbf5 commit 9f5b9f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const LinkedStandards = ({ creCode, linkedTo, applyHighlight, filter }) =
*/
function isExternalLink(x: LinkedTreeDocument, linkedTo: any) {
if (!x.document.hyperlink) {
console.log(x.document);
return false;
}
const siblingCount = linkedTo.reduce((count, obj) => {
Expand Down
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 9f5b9f1

Please sign in to comment.