In the dataset route, we render the UI based on the dataset lifecycle states which include unprocessed, processing, processed (unexpired or expired), and processing error.
If the dataset state is processed but expired, we provide users options to regenerate it.
In the FileSummary component, we have a local state regeneratedDataset that stores the reference to that expired dataset. This allows us to re-render the appropriate UI when users change dataset download options before regenerating that dataset.
// sets expired processed dataset as regeneratedDataset
if (isReadyExpired) setRegeneratedDataset(dataset)
Instead of storing the reference of the expired dataset, we want to make a copy of the dataset reference and selectively copy only the necessary fields.
To achieve this, we should add a new helper getDatasetFrom to the useDatasetManager hook. This method will handle the copying and extraction of the relevant fields from the expired dataset object, which will be used when setting the value of setRegeneratedDataset as follows:
setRegeneratedDataset(getDatasetFrom(dataset))
Solution or next step
Add a new helper getDatasetFrom to useDatasetManager that does the following:
Takes dataset as its argument
Returns a new dataset object with the following fields:
data
aggregate_by
scale_by
quantile_normalize
Use this new helper when setting the regeneratedDataset state in FileSummary
Context
Epic: #358
In the
dataset
route, we render the UI based on the dataset lifecycle states which include unprocessed, processing, processed (unexpired or expired), and processing error.If the dataset state is processed but expired, we provide users options to regenerate it.
In the
FileSummary
component, we have a local stateregeneratedDataset
that stores the reference to that expired dataset. This allows us to re-render the appropriate UI when users change dataset download options before regenerating that dataset.Instead of storing the reference of the expired dataset, we want to make a copy of the dataset reference and selectively copy only the necessary fields.
e.g., The required fields:
Problem or idea
To achieve this, we should add a new helper
getDatasetFrom
to theuseDatasetManager
hook. This method will handle the copying and extraction of the relevant fields from the expireddataset
object, which will be used when setting the value ofsetRegeneratedDataset
as follows:Solution or next step
getDatasetFrom
touseDatasetManager
that does the following:dataset
as its argumentdata
aggregate_by
scale_by
quantile_normalize
regeneratedDataset
state inFileSummary