Dependency: #361
A PR for this issue will be based off the above issue's PR branch.
(Due to frequent edits to the same files, the above dependency was added to this issue to minimize merge conflicts.)
In /download and dataset routes, we render the UI based on the dataset lifecycle states which include unprocessed, processing, processed (unexpired or expired), and processing error.
Currently, we set these values by destructuring dataset and creating all the appropriate variables within the components for conditional UI rendering logic.
Problem or idea
This approach clutters each component's implementation. Thus, we should create a dedicated helper to handle the assignments of these dataset lifecycle states. This will improve the readability and maintainability of our codebase.
Solution or next step
Add a new helper getDatasetState that does the following:
Takes dataset as its argument
Returns the following lifecycle variables (names may differ):
(Mutable)
unprocessed : isNotProcessed
(Immutable)
processing : isProcessing
processed
unexpired (available for download) : isReady
expired (available for regeneration download) : isRegenerative
processing error : isProcessingError
Use this new helper and clean up locally defined dataset lifecycle state variables and destructuring of dataset from the components
Context
Epic: #358
Dependency: #361 A PR for this issue will be based off the above issue's PR branch. (Due to frequent edits to the same files, the above dependency was added to this issue to minimize merge conflicts.)
In
/download
anddataset
routes, we render the UI based on the dataset lifecycle states which include unprocessed, processing, processed (unexpired or expired), and processing error.Currently, we set these values by destructuring
dataset
and creating all the appropriate variables within the components for conditional UI rendering logic.Problem or idea
This approach clutters each component's implementation. Thus, we should create a dedicated helper to handle the assignments of these dataset lifecycle states. This will improve the readability and maintainability of our codebase.
Solution or next step
getDatasetState
that does the following:dataset
as its argumentisNotProcessed
isProcessing
isReady
isRegenerative
isProcessingError
dataset
from the components