Skip to content

Conversation

zoldello
Copy link
Contributor

No description provided.

@zoldello zoldello force-pushed the ENCD-6126--add-element-ref-to-file-details branch from 039feef to a77926e Compare August 27, 2021 22:58
@zoldello zoldello marked this pull request as ready for review August 30, 2021 22:22
@zoldello zoldello requested review from forresttanaka and removed request for forresttanaka August 30, 2021 23:24
@zoldello zoldello requested a review from forresttanaka August 31, 2021 02:45
forresttanaka
forresttanaka previously approved these changes Aug 31, 2021
Copy link
Contributor

@forresttanaka forresttanaka left a comment

Choose a reason for hiding this comment

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

OK, I think this works, basically adding FCC experiments’ reference files to the array of reference files. I have a couple suggestions in case you feel like taking them.

const elementsReferences = context.elements_references;

if (elementsReferences) {
const elementsReferenceFiles = elementsReferences.map((elementsReference) => elementsReference.files).reduce((acc, val) => acc.concat(val), []);
Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you’re doing, though I think it’d be easier to understand in one step:

const elementsReferenceFiles = elementsReferences.reduce((accFiles, reference) => accFiles.concat(reference.files));

@@ -2975,7 +2987,9 @@ class FileGalleryRendererComponent extends React.Component {
this.experimentType = props.context['@type'][0];

const seriesFiles = getSeriesFiles(props.context) || [];
const datasetFiles = [...props.data, ...seriesFiles];
const elementsReferenceFiles = props.context.elements_references?.map((elementsReference) => elementsReference.files).reduce((acc, val) => acc.concat(val), []) || [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move this into a utility function shared here and in your first change above? They do the same thing, and a well-named utility function would help documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants