-
Notifications
You must be signed in to change notification settings - Fork 51
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
ENCD-6126--add-element-ref-to-file-details #4084
base: dev
Are you sure you want to change the base?
Conversation
039feef
to
a77926e
Compare
There was a problem hiding this 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), []); |
There was a problem hiding this comment.
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), []) || []; |
There was a problem hiding this comment.
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.
No description provided.