You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The formatExperiments method is currently used within the useDatasetManager hook to format the experiments field for the UI. We want to extract this method from the hook and have the data presentation components handle the formatting instead.
e.g., ) The experiments field detailing the dataset's experiments and is mainly used on the dataset page:
experiments: [{title: "Drug-induced change in g…agents for 2, 6 and 24h",accession_code: "GSE116436",organism_names: […],sample_metadata: […],technology: "MICROARRAY"}]
The formatExperiments function:
// formats the sample and experiment arrays from the API response// to objects with experiment accession codes as their keys for UIconstformatExperiments=(experiments=[])=>{if(!experiments.length)return{}returnexperiments.reduce((acc,experiment)=>({
...acc,[experiment.accession_code]: experiment}),{})}
Problem or idea
To achieve this, we should decouple formatExperiments from the useDatasetManager and make it a standalone helper function that can be used in the data presentation components.
Solution or next step
Move the formatExperiments function to a new helper file, helpers/getFormattedExperiments.
Refactor all the useDatasetManager methods to return the API response without formatting
Update the data presentation components to use helpers/getFormattedExperiments for formatting experiments
The text was updated successfully, but these errors were encountered:
Context
Epic: #358
The
formatExperiments
method is currently used within theuseDatasetManager
hook to format the experiments field for the UI. We want to extract this method from the hook and have the data presentation components handle the formatting instead.e.g., ) The
experiments
field detailing the dataset's experiments and is mainly used on the dataset page:The
formatExperiments
function:Problem or idea
To achieve this, we should decouple
formatExperiments
from theuseDatasetManager
and make it a standalone helper function that can be used in the data presentation components.Solution or next step
Move the
formatExperiments
function to a new helper file,helpers/getFormattedExperiments
.Refactor all the
useDatasetManager
methods to return the API response without formattingUpdate the data presentation components to use
helpers/getFormattedExperiments
for formattingexperiments
The text was updated successfully, but these errors were encountered: